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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to