You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Tom Schneider (JIRA)" <ji...@apache.org> on 2007/10/30 05:04:39 UTC

[jira] Commented: (WW-794) Issue with ServletDispatcherResponse after a JasperException

    [ https://issues.apache.org/struts/browse/WW-794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42468 ] 

Tom Schneider commented on WW-794:
----------------------------------

When you get the JasperException, has jasper started writing the response yet?  If the response is already setup to output the pdf (or whatever output jasper is writing) then you may be out of luck because the response is in a state where you can't go back to html.  I'm not sure skipping the page context include would be a good idea at that point.  We would have the same issue with a regular jsp that was writing an image or some other non-html data.

> Issue with ServletDispatcherResponse after a JasperException
> ------------------------------------------------------------
>
>                 Key: WW-794
>                 URL: https://issues.apache.org/struts/browse/WW-794
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Dispatch
>    Affects Versions: WW 2.1.6, WW 2.1.7
>            Reporter: Grégory Joseph
>            Assignee: Rainer Hermanns
>             Fix For: 2.1.1
>
>         Attachments: skipPageContext-patch.tgz
>
>
> Following my thread on http://forums.opensymphony.com/thread.jspa?messageID=8487 , here's patch + testcase, in case you guys think the problem is valid.
> I had to resort to jmock-cglib, since I needed to mock the PageContext concrete class: you need jmock-1.0.1 , jmock-cglib-1.0.1 , cglib-2.0.2 and asm-1.4.3 for it to work.
> // Here's a copy of my original post, for the record:
> I'm having an issue with the ServletDispatcherResult : I have a 
> (simplistic) ExceptionInterceptor, which returns ERROR in case in 
> catches any Throwable.
> I have a global result for error, mapped to an ErrorAction of ours, 
> which currently just logs and returns SUCCESS (the idea being that it's 
> going to automatically send a mail to someone, or create a jira bug 
> report if appropriate). This in turn has its SUCCESS result mapped to a 
> dispatcher for some jsp.
> The problem actually occurs when the original action has a 
> JasperException thrown in its dispatched jsp view (currently using 
> tomcat 5.5.4) : the ServletDispatcherResult can't dispatch to the 
> error.jsp (which is the result of the ErrorAction), because, like jasper 
> reports, the Stream is already closed.
> I figured that by removing lines 58-62 from ServletDispatcherResult, 
> thing just work as I expect. That is, removing he pageContext.include 
> call, and letting my jsp be forwarded instead. Since I'm not sure what 
> the intent with pageContext.include is - I've seen an older jira report 
> mentionning it (WW-292), I thought it could simply be optional. (i.e, 
> adding a setSkipPageContextInclude(boolean skip) in ServletDispatcherResult)
> How does that sound? I'm currently working on a patch for this, but 
> PageContext being a concrete class, I needed to use jmock+jmock-cglib 
> instead of mockobjects. What do you guys think?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.