Resin 2.1.17 and HttpServletResponseWrapper
"Kenkichi Mahara" <[email protected]> Tue, 13 Jun 2006 16:26:36 +0900
| Newsgroups | gmane.text.xml.resin.user |
|---|---|
| Message-ID | <[email protected]> |
I'm using Resin 2.1.17 on Linux and getting two problems.
I created javax.servlet.Filter implement, it passed wrapped respose object
to chain.doFilter();
Like this:
public void doFilter(ServletRequest request, ServletResponse
response, FilterChain chain)
throws IOException, ServletException {
HttpServletResponseWrapper response2 =
new HttpServletResponseWrapper((HttpServletResponse)
response);
chain.doFilter(request, response2);
}
This is a simple JSP file which has an error.
-- test.jsp ---
<%@ page contentType="text/html" errorPage="/e1.jsp" %>
<html>
<body>
<%= a %>
</body>
</html>
Problems are:
(1) When errorPage is the jsp file, I expects errorP
age output, but I got 404 not found page.
(2) When errorPage is the static html file, I got exception:
[2006/06/01 17:39:01] http://localhost/test/filter/a3.jsp: tried to write
content (char=`o') beyond content-length (42).
java.lang.IllegalStateException: http://localhost/test/filter/a3.jsp: tried
to write content (char=`o') beyond content-length (42).
at
com.caucho.server.http.ResponseStream.writeChunk(ResponseStream.java:440)
at
com.caucho.server.http.ResponseStream.flushBuffer(ResponseStream.java:384)
at
com.caucho.server.http.ResponseStream.finish(ResponseStream.java:299)
at com.caucho.server.http.Response.finish(Response.java:1755)
at com.caucho.server.http.Response.sendError(Response.java:556)
at com.caucho.server.http.Response.sendError(Response.java:615)
at
javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseW
rapper.java:113)
at
com.caucho.server.http.ResponseAdapter.sendError(ResponseAdapter.java:262)
at
com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:141)
at test.Filter1.doFilter(Filter1.java:14)
at
com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:253)
at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:170)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:595)