tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 33058] - Request session null after chain.doFilter() in Filter class
Date Fri, 14 Jan 2005 09:44:14 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33058>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33058





------- Additional Comments From allistair.crossley@qas.com  2005-01-14 10:44 -------
i have also tried this out for you. i wrote 1 basic servlet that acquired the 
session and added a String attribute, 1 basic filter that attempted to acquire 
that attribute from the session, and 1 jsp that was forwarded to using a 
RequestDispatcher from the basic servlet after the session attribute was added. 
this was configured in web.xml with a filter-mapping using a url-pattern for 
the location of the jsp, i.e /tests/33058.jsp. the jsp also tries to output the 
session attribute.

test 1 revealed that the filter is not even touched when the basic servlet is 
requested. the jsp is arrived at however, and does output the correct session 
attribute.

i consulted the servlet 2.4 specification and found that in 2.4 you add an 
element called "dispatcher" to the filter-mapping so that RequestDispatchers 
work with the url-pattern (section 6.2.5)

i change the filter-mapping to 

<filter-mapping>
  <filter-name>Basic Filter</filter-name>
  <url-pattern>/views/test/*</url-pattern>
  <dispatcher>FORWARD</dispatcher>
</filter-mapping>

running this test reveals that the filter _can_ access the session value:

String myAttribute = (String) ((HttpServletRequest) request).
  getSession().getAttribute("myAttribute");

hope this helps.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message