Is there a way to get information about HTTP request from the method down the callstack of the HttpServlet request handler method?
In other words given I have a handler method like:
@WebServlet(name = "helloworld", value = "")
public class HelloServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
MyInternalClass.doSomeAction();
PrintWriter out = resp.getWriter();
out.println("Hello, world - App Engine Flexible");
}
}
I am looking for a way to get the information about the HTTP request (such as URL, headers, etc.) within the code of the MyInternalClass.doSomeAction() method.
The constraint is that I cannot modify the code of the servlet.
The similar looking question "retrieving servlet context in POJO" cannot be used as an answer. Its solution requires modifications that have to be implemented at the servlet level which is not possible in my case (see the above constraint).