File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to get Servlet Context ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get Servlet Context ?" Watch "How to get Servlet Context ?" New topic
Author

How to get Servlet Context ?

Siva Ram
Ranch Hand

Joined: Apr 04, 2002
Posts: 66
Hi,
I am using a SessTrack class which implements javax.servlet.http.HttpSessionBindingListener interface for session tracking in the application. The SessTrack is the helper class, in which I have to manipulate servlet context . In Servlet 2.2b API , Is there any way to perform this operation ?


Thanks and Regards,<br />Siva Ram .NR
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
The event you get in the listener is a HttpSessionBindingEvent. From that you can get the session
HttpSession s = evt.getSession();
from the session you can get the
ServletContext sc = s.getServletContext();
its all in the API. What you can't get is the HttpSessionContext, that method is deprecated and returns null since version 2.1
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get Servlet Context ?
 
Similar Threads
JSF - JasperException
Servlet Context without servlet
Help- Tomcat - getting current Context
Accessing servlet
Urgent Please : Whether WAS 4.0 supports Servlet 2.3 API ?????