Tag

HttpServletRequest

0 views collected around this technical thread.

Java Tech Enthusiast
Java Tech Enthusiast
Feb 11, 2024 · Backend Development

Why Passing HttpServletRequest to Async Threads Causes Bugs in Spring Boot

Passing a HttpServletRequest to a regular thread in Spring Boot causes Tomcat to recycle the request after the servlet returns, making parameters unavailable and yielding null values, so you must use the servlet async API (startAsync and complete) to keep the request alive.

HttpServletRequestJavaSpring Boot
0 likes · 18 min read
Why Passing HttpServletRequest to Async Threads Causes Bugs in Spring Boot
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Oct 15, 2023 · Backend Development

How SpringBoot Injects HttpServletRequest via ThreadLocal: A Deep Dive

This article explores how SpringBoot 2.6.12 injects HttpServletRequest into controllers using JDK dynamic proxies and ThreadLocal, detailing the underlying ObjectFactoryDelegatingInvocationHandler, RequestObjectFactory, RequestContextHolder, and DispatcherServlet processing flow with code examples and explains why injecting HttpServletRequest and HttpServletResponse in a controller is safe.

DispatcherServletHttpServletRequestJava
0 likes · 7 min read
How SpringBoot Injects HttpServletRequest via ThreadLocal: A Deep Dive
Top Architect
Top Architect
Aug 6, 2022 · Backend Development

Retrieving Client IP and Using ip2region for IP Geolocation in Java

This article explains how to obtain a client's IP address from HttpServletRequest in Java, convert it to geographic location using the ip2region library, and demonstrates various query methods, caching strategies, and Maven integration for efficient backend IP geolocation.

HttpServletRequestIP GeolocationJava
0 likes · 12 min read
Retrieving Client IP and Using ip2region for IP Geolocation in Java
Architecture Digest
Architecture Digest
Aug 3, 2022 · Backend Development

How to Retrieve Client IP and Use ip2region for IP Geolocation in Java

This article explains how to obtain a user's IP address from an HttpServletRequest, introduces the ip2region offline IP‑location library, demonstrates Maven integration and multiple Java query implementations—including file‑only, vector‑index, and full‑memory caching—while providing benchmark and testing instructions.

HttpServletRequestIP GeolocationJava
0 likes · 15 min read
How to Retrieve Client IP and Use ip2region for IP Geolocation in Java
Code Ape Tech Column
Code Ape Tech Column
Jul 22, 2022 · Backend Development

Retrieving Client IP and Geolocation in Java with HttpServletRequest and ip2region

This article explains how to obtain a user's IP address from an HttpServletRequest in Java, convert it to geographic location using the ip2region library, and provides detailed code examples, Maven setup, caching strategies, and performance testing procedures for backend developers.

GeolocationHttpServletRequestIP address
0 likes · 15 min read
Retrieving Client IP and Geolocation in Java with HttpServletRequest and ip2region
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Sep 9, 2021 · Backend Development

Uncovering How SpringBoot Injects HttpServletRequest via ThreadLocal and Dynamic Proxies

This article explains how SpringBoot injects HttpServletRequest into controllers using a JDK dynamic proxy and ThreadLocal storage, tracing the request object from the ObjectFactoryDelegatingInvocationHandler through RequestObjectFactory, RequestContextHolder, and the FrameworkServlet's processRequest lifecycle.

Backend DevelopmentDynamic ProxyHttpServletRequest
0 likes · 7 min read
Uncovering How SpringBoot Injects HttpServletRequest via ThreadLocal and Dynamic Proxies