File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes HttpSessions in non-servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpSessions in non-servlets" Watch "HttpSessions in non-servlets" New topic

HttpSessions in non-servlets

Shrikanth Goloposwami

Joined: Feb 09, 2001
Posts: 7
I have a HttpServlet controller that intercepts requests and maps those requests to Action objects. These Action objects are not HttpServlets; however, there is a need to retrieve the request sent by the HttpServlet controller, create a session and pass the request back to the controller for forwarding. The sessions are being created successfully in the Action objects, it just can't pass the session along to the HttpServlet controller. Is is possible to pass HttpSession objects from a non-servlet to a servlet via the request object?
Any thoughts?
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
You can have the javax.servlet.http.HttpServletRequest request as argument of your action methods.(or in the constructor)
Then when you call the action method, you still have a request object you can work with and you can send back to a servlet later.

/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
I agree. Here's the link:
subject: HttpSessions in non-servlets
It's not a secret anymore!