PreparatorServlet causes request and response objects to be used outside of
service() method
--------------------------------------------------------------------------------------------
Key: WW-2101
URL: https://issues.apache.org/struts/browse/WW-2101
Project: Struts 2
Issue Type: Bug
Components: Portlet Integration
Reporter: Rickard Öberg
Priority: Critical
The PreparatorServlet stores the request and response object to be used later.
The servlet spec (SRV.2.3.3.3) states the following:
"References to the request and response objects should not be given to objects
executing in other threads as the resulting behavior may be nondeterministic. If
the thread created by the application uses the container-managed objects, such
as
the request or response object, those objects must be accessed only within the
servlet's service life cycle and such thread itself should have a life cycle
within
the life cycle of the servlet's service method because accessing those objects
after the service method ends may cause undeterministic problems."
So, it is not legal to store those objects as there is no way to know that the
objects are valid after the service() invocation. And indeed, in our portal
container implementation those object are immediately invalidated after the
service() method, causing deterministically problematic situations for our
users that has chosen Struts 2.
I understand that the whole idea of using PreparatorServlet is to get a
reference to ServletRequest and ServletResponse objects, but it is not a valid
way to do it. It would probably be better if it was possible to simple
implement wrapper objects that work with the PortletRequest and PortletResponse
objects instead, in the portlets render() method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.