You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Eric Dalquist (JIRA)" <pl...@jakarta.apache.org> on 2005/03/03 20:50:53 UTC

[jira] Created: (PLUTO-112) RenderResponseImpl.setBufferSize breaks servlet spec

RenderResponseImpl.setBufferSize breaks servlet spec
----------------------------------------------------

         Key: PLUTO-112
         URL: http://issues.apache.org/jira/browse/PLUTO-112
     Project: Pluto
        Type: Bug
  Components: portlet container  
    Versions: 1.0.1-rc2    
    Reporter: Eric Dalquist


The RenderResponseImpl.setBufferSize method always throws an exception. The servlet spec states that this method must be called before any response content is written or an exception will be thrown and that it cannot be called after content is starting to be written.

When running in WebLogic the JSP parsing/rendering libraries used create code that calls the setBufferSize on the response. This results in an un-caught exception being thrown on WebLogic any time a JSP is rendered by a portlet.

Commenting out the setBufferSize/getBufferSize methods of the RenderResponseImpl seem to fix the problem since the calls are just passed to the underlying HttpServletResponse.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (PLUTO-112) RenderResponseImpl.setBufferSize breaks servlet spec

Posted by "Michael Blum (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-112?page=all ]
     
Michael Blum resolved PLUTO-112:
--------------------------------

    Fix Version: Current CVS
     Resolution: Fixed

I stalled the patches from Ulrich Kuester and tested them. All worked fine.

> RenderResponseImpl.setBufferSize breaks servlet spec
> ----------------------------------------------------
>
>          Key: PLUTO-112
>          URL: http://issues.apache.org/jira/browse/PLUTO-112
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>     Reporter: Eric Dalquist
>      Fix For: Current CVS
>  Attachments: jira112_2_patch.txt, jira112_3_patch.txt, jira112_patch.txt
>
> The RenderResponseImpl.setBufferSize method always throws an exception. The servlet spec states that this method must be called before any response content is written or an exception will be thrown and that it cannot be called after content is starting to be written.
> When running in WebLogic the JSP parsing/rendering libraries used create code that calls the setBufferSize on the response. This results in an un-caught exception being thrown on WebLogic any time a JSP is rendered by a portlet.
> Commenting out the setBufferSize/getBufferSize methods of the RenderResponseImpl seem to fix the problem since the calls are just passed to the underlying HttpServletResponse.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (PLUTO-112) RenderResponseImpl.setBufferSize breaks servlet spec

Posted by "Ulrich Küster (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-112?page=all ]

Ulrich Küster updated PLUTO-112:
--------------------------------

    Attachment: jira112_2_patch.txt

Original patch could not be applied under Unix systems due to absolute file paths using C:/ notation.
Changed file paths to relative paths.

> RenderResponseImpl.setBufferSize breaks servlet spec
> ----------------------------------------------------
>
>          Key: PLUTO-112
>          URL: http://issues.apache.org/jira/browse/PLUTO-112
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>     Reporter: Eric Dalquist
>  Attachments: jira112_2_patch.txt, jira112_patch.txt
>
> The RenderResponseImpl.setBufferSize method always throws an exception. The servlet spec states that this method must be called before any response content is written or an exception will be thrown and that it cannot be called after content is starting to be written.
> When running in WebLogic the JSP parsing/rendering libraries used create code that calls the setBufferSize on the response. This results in an un-caught exception being thrown on WebLogic any time a JSP is rendered by a portlet.
> Commenting out the setBufferSize/getBufferSize methods of the RenderResponseImpl seem to fix the problem since the calls are just passed to the underlying HttpServletResponse.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (PLUTO-112) RenderResponseImpl.setBufferSize breaks servlet spec

Posted by "Ulrich Küster (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-112?page=all ]

Ulrich Küster updated PLUTO-112:
--------------------------------

    Attachment: jira112_3_patch.txt

Unfortunately there was still a path problem. I hope it is corrected now and there won't be any more problems.

> RenderResponseImpl.setBufferSize breaks servlet spec
> ----------------------------------------------------
>
>          Key: PLUTO-112
>          URL: http://issues.apache.org/jira/browse/PLUTO-112
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>     Reporter: Eric Dalquist
>  Attachments: jira112_2_patch.txt, jira112_3_patch.txt, jira112_patch.txt
>
> The RenderResponseImpl.setBufferSize method always throws an exception. The servlet spec states that this method must be called before any response content is written or an exception will be thrown and that it cannot be called after content is starting to be written.
> When running in WebLogic the JSP parsing/rendering libraries used create code that calls the setBufferSize on the response. This results in an un-caught exception being thrown on WebLogic any time a JSP is rendered by a portlet.
> Commenting out the setBufferSize/getBufferSize methods of the RenderResponseImpl seem to fix the problem since the calls are just passed to the underlying HttpServletResponse.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (PLUTO-112) RenderResponseImpl.setBufferSize breaks servlet spec

Posted by "Ulrich Küster (JIRA)" <pl...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/PLUTO-112?page=all ]

Ulrich Küster updated PLUTO-112:
--------------------------------

    Attachment: jira112_patch.txt

Patch for suggested solution (switch configured by new parameter portletcontainer.supportsBuffering)


> RenderResponseImpl.setBufferSize breaks servlet spec
> ----------------------------------------------------
>
>          Key: PLUTO-112
>          URL: http://issues.apache.org/jira/browse/PLUTO-112
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>     Reporter: Eric Dalquist
>  Attachments: jira112_patch.txt
>
> The RenderResponseImpl.setBufferSize method always throws an exception. The servlet spec states that this method must be called before any response content is written or an exception will be thrown and that it cannot be called after content is starting to be written.
> When running in WebLogic the JSP parsing/rendering libraries used create code that calls the setBufferSize on the response. This results in an un-caught exception being thrown on WebLogic any time a JSP is rendered by a portlet.
> Commenting out the setBufferSize/getBufferSize methods of the RenderResponseImpl seem to fix the problem since the calls are just passed to the underlying HttpServletResponse.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (PLUTO-112) RenderResponseImpl.setBufferSize breaks servlet spec

Posted by "Ulrich Küster (JIRA)" <pl...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/PLUTO-112?page=comments#action_12315245 ] 

Ulrich Küster commented on PLUTO-112:
-------------------------------------

According to the servlet spec buffering is not supported in the special context of a servlet, that has been invoked via include by another servlet. However, this is exactly the technology used in pluto.

Since e.g. Tomcat (conforming to the servlet spec) doesn't support buffering, it's unsafe to generally simply pass the getBufferSize() and setBufferSize() calls to the
underlying HttpServletResponse methods.

Instead I suggest to introduce a switch, a new property "container.supportsBufferSize" in the ConfigService.properties file, to configure that behaviour. 
If explicitly set to yes, setBufferSize() and getBufferSize() calls will be passed to the underlying HttpServletResponse methods.
In any other case the old behaviour is unchanged.

The config parameter is read in Servlet.init(...) and passed to PortletContainerImpl 
where it is stored in a private member.

PortletContainerImpl.portletLoad(...) and PortletContainerImpl.renderPortlet(...) 
pass the parameter via the following chain:

PortletObjectAccess.getRenderResponse(...)
	RenderResponseFactory.getRenderResponse(...)
		RenderResponseImpl(...)
		
The setBufferSize() methods then uses that member to decide whether to throw  an IllegalStateException or pass the call to the underlying HttpServletResponse.
The getBufferSize() method analogously will simply return 0 or also pass the call to the underlying HttpServletResponse.

I attached a tested patch that implements this suggestion.


> RenderResponseImpl.setBufferSize breaks servlet spec
> ----------------------------------------------------
>
>          Key: PLUTO-112
>          URL: http://issues.apache.org/jira/browse/PLUTO-112
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>     Reporter: Eric Dalquist
>  Attachments: jira112_patch.txt
>
> The RenderResponseImpl.setBufferSize method always throws an exception. The servlet spec states that this method must be called before any response content is written or an exception will be thrown and that it cannot be called after content is starting to be written.
> When running in WebLogic the JSP parsing/rendering libraries used create code that calls the setBufferSize on the response. This results in an un-caught exception being thrown on WebLogic any time a JSP is rendered by a portlet.
> Commenting out the setBufferSize/getBufferSize methods of the RenderResponseImpl seem to fix the problem since the calls are just passed to the underlying HttpServletResponse.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (PLUTO-112) RenderResponseImpl.setBufferSize breaks servlet spec

Posted by "Michael Blum (JIRA)" <pl...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/PLUTO-112?page=comments#action_12315841 ] 

Michael Blum commented on PLUTO-112:
------------------------------------

Ulrich, thank you for your support on this problem.  I ran some tests with your patches in place and everything was successful. I am going to commit the patches ASAP.

> RenderResponseImpl.setBufferSize breaks servlet spec
> ----------------------------------------------------
>
>          Key: PLUTO-112
>          URL: http://issues.apache.org/jira/browse/PLUTO-112
>      Project: Pluto
>         Type: Bug
>   Components: portlet container
>     Versions: 1.0.1-rc2
>     Reporter: Eric Dalquist
>  Attachments: jira112_2_patch.txt, jira112_3_patch.txt, jira112_patch.txt
>
> The RenderResponseImpl.setBufferSize method always throws an exception. The servlet spec states that this method must be called before any response content is written or an exception will be thrown and that it cannot be called after content is starting to be written.
> When running in WebLogic the JSP parsing/rendering libraries used create code that calls the setBufferSize on the response. This results in an un-caught exception being thrown on WebLogic any time a JSP is rendered by a portlet.
> Commenting out the setBufferSize/getBufferSize methods of the RenderResponseImpl seem to fix the problem since the calls are just passed to the underlying HttpServletResponse.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira