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 2012/07/13 09:53:20 UTC

[Bug 53545] New: jsp:forward action to static resources causes IllegalStateException when inside classic custom tag

https://issues.apache.org/bugzilla/show_bug.cgi?id=53545

          Priority: P2
            Bug ID: 53545
          Assignee: dev@tomcat.apache.org
           Summary: jsp:forward action to static resources causes
                    IllegalStateException when inside classic custom tag
          Severity: major
    Classification: Unclassified
          Reporter: radu.gancea@gmail.com
          Hardware: PC
            Status: NEW
           Version: 7.0.28
         Component: Servlet & JSP API
           Product: Tomcat 7

If we have a JSP like the one below we get java.lang.IllegalStateException:
getOutputStream() has already been called for this response:

Notes:
1. the jsp:forward is inside classic custom tag ( extends BodyTagSupport).
2. if I put a dynamic resource everything is fine (ex. redirect.jsp)
3. I think that the response gets flushed if jsp:forward redirects to a static
resource and that's why the exception is trown.



test.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="t" uri="test" %> 

<t:do>  

<jsp:forward page="redirect.html"/>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
</body>
</html>

</t:do>

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 53545] jsp:forward action to static resources causes IllegalStateException when inside classic custom tag

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53545

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
OK. I see what is going on here now. A bug (now fixed) in the custom error page
handling wasn't helping.

Tomcat isn't clearing the buffer of the containing page when the forward
happens. When Tomcat tries to write that content (after the forward) the ISE
happens.

I think I have a fix but I need to do some more testing of the behavior with
nested tags before I commit the fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 53545] jsp:forward action to static resources causes IllegalStateException when inside classic custom tag

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53545

Radu Gancea <ra...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #2 from Radu Gancea <ra...@gmail.com> ---
I know that. But jsp:forward action throws IllegalState only when the page is
unbuffered. If it's buffered, the buffer clears, the forwarding executes and
the rest of the page doesn't execute.


In the generated java files for classic tags there is a finally block that
calls a method that invokes getOutputStream and I think it shouldn't. If I use
SimpleTag the forward works as it should.


Quote from specs:
"And as with jsp:forward actions from one JSP page to another, the following
statement would clear the page buffer, terminate the execution of the JSP page,
and execute the servlet: 
<jsp:forward page="/servlet/MyServlet" />"


I am not writing anything inside doStartTag(), etc. 


Please reconsider. I won't open the issue again and sorry if I am too
insistent.
Thank you.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 53545] jsp:forward action to static resources causes IllegalStateException when inside classic custom tag

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53545

Radu Gancea <ra...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |radu.gancea@gmail.com
                 OS|                            |All

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 53545] jsp:forward action to static resources causes IllegalStateException when inside classic custom tag

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53545

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
This has been fixed in trunk and 7.0.x and will be included in 7.0.30 onwards.
I also added a test case to the unit tests for this issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 53545] jsp:forward action to static resources causes IllegalStateException when inside classic custom tag

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53545

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
You should not be writing content after a forward. That it works in any
circumstances is pure luck.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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