Reputation: 113
Can someone tell whether is there a way to get HttpServletRequest and HttpServletResponse in Spring JMS listener class? My JMS listener is defined in springContext.xml file.
Upvotes: 0
Views: 787
Reputation: 113
I ended up using JAXDispatcher
to invoke my service, from my JMS listener.
jaxbDispatcher.doGET(null, url, null, "application/xml", true);
Upvotes: 0
Reputation: 340733
First of all you don't have access to HTTP servlet request and response within JMS listeners. These are completely independent modules that can even reside on different physical servers.
You can use MockHttpServletRequest
and MockHttpServletResponse
from spring-test.jar
- but they are meant to be used within unit/integration tests, not in production code.
I would really like to see your code that requires MockHttpServletRequest
and response. My guess is that it can be refactored or redesigned to use only relevant fields from the above, like request URL or user name.
Upvotes: 1