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 "Ulrich Küster (JIRA)" <pl...@jakarta.apache.org> on 2005/07/07 17:15:11 UTC

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

    [ 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