Mantis - Resin
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
989 | minor | always | 03-13-06 14:32 | 04-13-06 10:59 | |
|
|||||
Reporter: | ferg | Platform: | |||
Assigned To: | ferg | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 3.0.18 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 3.0.19 | ||
|
|||||
Summary: | 0000989: JSP wrapper issue | ||||
Description: |
(rep by Tony Field) I am wrapping a ServletResponse, then am creating a request dispatcher and then including a standard JSP using my wrapped response: My servlet uses a manager class to handle includes. Here is the interesting code: public ServletRRManager(HttpServlet servlet, HttpServletRequest request, HttpServletResponse response) { this.servlet = servlet; this.request = new MyHttpServletRequest(request); responseStack = new Stack<MyHttpServletResponse>(); responseStack.push(new MyHttpServletResponse(response)); } public void include(String path) throws IncludeException { RequestDispatcher rd = request.getRequestDispatcher(path); try { MyHttpServletResponse res = responseStack.peek(); rd.include(request, res); } catch (Exception e) { throw new IncludeException("Failure including resource at " + path, e); } } ... My wrapper class is really simple - basically it captures the output of the getWriter() content in a StringWriter and the getOutputStream() content in a ByteArrayOutputStream. My wrapper has accessor methods for this data and I process it before streaming it to the actual response (this processing is effectively the ultimate goal of the whole pile of code - we are refactoring our caching engine). I have noticed that I can't include a JSP if I have already grabbed the outputStream because the JSP will always try to grab the writer. This seems reasonable. However, if my caller grabs the writer instead, then includes a JSP, then tries to either write to the writer again or grab it again from the response wrapper, it fails because somewhere in the JSP include code the checkError() flag of the PrintWriter has been set: it seems that including a JSP "corrupts" my PrintWriter. |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|