Thanks, I modified things slightly.  You are correct that everything
would appear to work correctly, if the line was simply removed.  But
what is happening in the Turbine servlet here is that an exception would
be thrown if data.getOut() was not called, but it was being immediately
caught and discarded as irrelevant.  That does not seem to be the best
solution in Turbine.java, so in the event this behavior changes I
thought it best to make it clear that the Jsp was taking over
responsibility for the response.


ingo schuster wrote:
> 
> John,
> 
> I found another problem in the JSP Service, in the JspLayout.class
> (doBuild, please see below).
> The problem:
> data.getOut() is called, for no obvious reason. With Tomcat this is ok,
> however Websphere's servlet engine doesn't allow to retrieve the output
> stream more than once per request. If you call getOut() in JSPLayout,
> you'll get an exception when you try "dispatcher.forward" later on
> (dispatcher.include works fine). I think this servlet engine behavior is
> ok: as far as I know, it is for example forbidden to generate output in a
> JSP Page and then forward the request to another JSP - once you generated
> output, you may only _include_ other JSPs.
> Anyway, your code doesn't break on tomcat if you remove the data.getOut()
> statement, but it is a necessity to remove for WAS. Can you commit this change?
> 
> Thanks,
>                 ingo.
> 
> public class JspLayout extends Layout
> {
>      /**
>       * Method called by LayoutLoader.
>       *
>       * @param RunData
>       * @return processed template in a String
>       */
>      public void doBuild(RunData data) throws Exception
>      {
>          data.getResponse().setContentType("text/html");
> -        data.getOut();
>          // variable to reference the screen in the layout template
>          data.getRequest()
>              .setAttribute("screen_placeholder",
>                  new JspScreenPlaceholder(data));
>          // variable to reference the navigations in the layout template
>          data.getRequest()
>              .setAttribute("navigation", new JspNavigation(data));
> 
>          // Grab the layout template set in the TemplatePage.
>          String templateName = data.getTemplateInfo().getLayoutTemplate();
>          // Finally, generate the layout template and output to the response
>          JspService jsp = (JspService)TurbineServices.getInstance()
>              .getService(JspService.SERVICE_NAME);
>          jsp.handleRequest(data, "/layouts" + templateName, true);
>      }
> }
> 
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to