servlets - Get the HttpServletRequest (request) object from Java code -
I have to capture the request object in java code. I can not extract my object in my code for some reasons. Is there any way I can say something: getCurrentHTTPServletRequest ? It is safe for me to believe that I am in a service context. Well you should require it below if you need it It's basically anything that you do will be ugly. You can use - basically set the context of that particular thread when you receive the request, and then receive it later. This will work for such a long time until you only need to get the request within the thread which is processing it - and unless you have any funky handling of asynchronous request. Although it is misleading for exactly the same reasons. However, I strongly advise you to clarify your dependence on strongly . Either enter the servlet request below, or just the bits you need.