Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

getServletContextName returns NULL in a filter ??

843841Jan 12 2004 — edited Feb 7 2005
I have set a context for this web app in its xml file in the conf/Catalina/Locahost folder of tomcat 5.0.16
However, when trying to get the context name when in a filter, I get null. Can anyone explain why. The code is below:-

public void attributeAdded(HttpSessionBindingEvent event)
{
HttpSession session = event.getSession();
String contextname = session.getServletContext().getServletContextName();


Is this because I have the jar file containing this in my common/lib folder, even though I am accessing it via a webapp context ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 7 2005
Added on Jan 12 2004
2 comments
557 views