tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jay Burgess <jburg...@digarch.com>
Subject RE: Why ignore sendRedirect() for an include? - solved
Date Mon, 20 May 2002 19:45:00 GMT
This question ended up getting answered back on the JSP list (many thanks 
to Hans Bergsten!). The spec very clearly calls out the issue in section 
JSP.4.4:

"An included page only has access to the JspWriter object and it cannot set 
headers. This precludes invoking methods like setCookie(). Attempts to 
invoke these methods will be ignored."

My oversight. Thanks anyway.

Jay


 > -----Original Message-----
 > From: Jay Burgess [mailto:jburgess@digarch.com]
 > Sent: Monday, May 20, 2002 11:08 AM
 > To: tomcat-user@jakarta.apache.org
 > Subject: Why ignore sendRedirect() for an include?
 >
 >
 > I started this discussion on the JSP list, but am led to
 > believe now that
 > this is a Tomcat issue.  Can someone explain otherwise?
 >
 > My problem is that a sendRedirect() issued by my servlet is not being
 > honored by Tomcat 4.0.3.  The servlet is being called via a
 > <jsp:include>
 > block from within a JSP.  The sendRedirect() is the first thing in my
 > doGet().   As long as the response hasn't been committed,
 > this should be
 > legal, right?  (I confirmed that the response had not been
 > committed with
 > res.isCommitted() .)
 >
 > To confuse me even more, I found the following in the Tomcat source
 > (ApplicationHttpResponse.java):
 >
 >     /**
 >       * Disallow <code>sendRedirect()</code> calls on an
 > included response.
 >       *
 >       * @param location The new location
 >       *
 >       * @exception IOException if an input/output error occurs
 >       */
 >      public void sendRedirect(String location) throws IOException {
 >          if (!included)
 >              ((HttpServletResponse)
 > getResponse()).sendRedirect(location);
 >      }
 >
 > Can someone confirm that the reason my sendRedirect() is
 > failing is because
 > of the above (!included) check, and even more importantly,
 > WHY you don't
 > allow sendRedirect()'s on an included response?
 >
 > Thanks.
 >
 > Jay
 >
 >


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message