-
May 15th, 2007, 07:11 PM
#1
retrieving current Http Request from a Spring Bean
Hello,
I would like to retrieve the HTTP request from a Spring Bean if it is running in a WebApplicationContext.
With ApplicationContextAware I've got an ApplicationContext and after casting a WebApplicationContext and could like that get the ServletContext.
But I could not find how to retreive the current http request. Is it possible ?
I know it is a strange need, but if it is possible I'll use it for testing purpose.
Thanks
Cyrille
-
May 16th, 2007, 03:21 AM
#2
No, not directly. You can use RequestContextListener and RequestContextHolder, retrieve currentRequestAttributes() from the latter where RequestAttributes is a Spring interface. If that's not sufficient you can cast it to ServletRequestAttributes and call getRequest() on it to have access to the HttpServletRequest.
Jörg
-
May 16th, 2007, 06:37 AM
#3
What is it that you want to do with the HttpSession?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules