Getting request object outside of DispatchServlet.
Jay Abrahm
Ranch Hand
Joined: May 28, 2008
Posts: 182
posted
0
I am trying to get the request object so that I could get the application URL outside of the dispatch servlet. I tried all three methods below and it returned null.
Is there any other way to get the request object from the RequestContextListener
Next question, how is that code being called. If is comes from a request already and goes first into the Controller or Action, then just get the data out of the request there and pass that down.
I think there is a design/architecture design flaw where you would need the HttpServletRequest passing into a non-controller/action class.
Mark
Jay Abrahm
Ranch Hand
Joined: May 28, 2008
Posts: 182
posted
0
The Spring container (if I can use that work here) calls this class since I have AbstractRoutingDataSource defined.
I basically need the HttpServletRequest so that I can get the URL to decide the datasource to connect to. If I can get the URL parameters in any other way that should do just fine.
I think personally I would use a standard filter to do this as it will have to be set for each request. That way you get the request passed in anyway to do your logic.
Sean
I love this place!
MarK sujoKi
Greenhorn
Joined: Sep 11, 2012
Posts: 2
posted
0
@Jay Abrahm
Were you able to get the request object outside of DispatchServlet? If yes, could you please share how?