You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/06/18 03:46:00 UTC
DO NOT REPLY [Bug 20849] New: -
RequestDispatcher.include'd Servlets/JSPs cannot addCookie
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20849>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20849
RequestDispatcher.include'd Servlets/JSPs cannot addCookie
Summary: RequestDispatcher.include'd Servlets/JSPs cannot
addCookie
Product: Tomcat 4
Version: 4.1.24
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Catalina
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: davec@sybase.com
The class org.apache.catalina.core.ApplicationResponseWrapper overrides the
addCookie method:
/**
* Disallow <code>addCookie()</code> calls on an included response.
*
* @param cookie The new cookie
*/
public void addCookie(Cookie cookie) {
if (!included)
((HttpServletResponse) getResponse()).addCookie(cookie);
}
The "included" boolean value is set to true when this ResponseWrapper subclass
is being passed to a Servlet or JSP invoked via RequestDispatcher.include.
The effect is that if the include servlet/JSP calls response.addCookie(cookie)
the cookie is ignored, and is not sent back to the browser.
I have looked hard at the Servlet 2.4 specification, and see nowhere that states
that included servlets/JSPs should not be allowed to set cookies.
I think we should just remove the if (!included) test -- always add the cookie
to the response.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org