You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Rickard Öberg (JIRA)" <ji...@apache.org> on 2007/08/10 10:11:18 UTC

[jira] Created: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

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.


[jira] Assigned: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Rene Gielen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rene Gielen reassigned WW-2101:
-------------------------------

    Assignee: Nils-Helge Garli  (was: Rene Gielen)

Backport to 2.0.10 checked in.

Nils, please review.

> 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
>            Assignee: Nils-Helge Garli
>            Priority: Critical
>             Fix For: 2.0.10, 2.1.0
>
>
> 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.


[jira] Resolved: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nils-Helge Garli resolved WW-2101.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.0

Fixed by the new org.apache.struts2.portlet.servlet classes. Also removed the Preparator and ServletContextHolderListener.

> 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
>            Assignee: Nils-Helge Garli
>            Priority: Critical
>             Fix For: 2.1.0
>
>
> 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.


[jira] Updated: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Rene Gielen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rene Gielen updated WW-2101:
----------------------------

    Fix Version/s: 2.0.10

> 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
>            Assignee: Rene Gielen
>            Priority: Critical
>             Fix For: 2.0.10, 2.1.0
>
>
> 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.


[jira] Resolved: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nils-Helge Garli resolved WW-2101.
----------------------------------

    Resolution: Fixed

> 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
>            Assignee: Nils-Helge Garli
>            Priority: Critical
>             Fix For: 2.0.10, 2.1.0
>
>
> 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.


[jira] Commented: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41785 ] 

Nils-Helge Garli commented on WW-2101:
--------------------------------------

Funny you should report this now. It's currently beeing fixed for 2.1 using "mock" servlet objects instead, wrapping the portlet objects. Try the 2.1 snapshots and  see if it works.

> 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.


[jira] Commented: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Aleksander Adamowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42791 ] 

Aleksander Adamowski commented on WW-2101:
------------------------------------------

Don't you think that removing Preparator and ServletContextHolderListener without even noting it in release notes (http://struts.apache.org/2.0.11/docs/release-notes-2010.html, http://struts.apache.org/2.0.11/docs/release-notes-2011.html) is a bit irresponsible?

The Maven archtypes which provide example projects (e.g. struts2-archetype-portlet) contain references to those classes in web.xml and they get broken when updating struts2-core JAR to 2.0.10 or 2.0.11.

The example web.xml contains this:

    <listener>
		<listener-class>
			org.apache.struts2.portlet.context.ServletContextHolderListener
		</listener-class>
	</listener>

	<servlet id="preparator">
		<servlet-name>preparator</servlet-name>
		<servlet-class>
			org.apache.struts2.portlet.context.PreparatorServlet
		</servlet-class>
	</servlet>


What to do in 2.0.10 an later? Simply remove the listener and preparator? Won't something break in a mysterious way?


> 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: Plugin - Portlet
>            Reporter: Rickard Öberg
>            Assignee: Nils-Helge Garli
>            Priority: Critical
>             Fix For: 2.0.10, 2.1.0
>
>
> 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.


[jira] Assigned: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nils-Helge Garli reassigned WW-2101:
------------------------------------

    Assignee: Nils-Helge Garli

> 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
>            Assignee: Nils-Helge Garli
>            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.


[jira] Resolved: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nils-Helge Garli resolved WW-2101.
----------------------------------

    Resolution: Fixed

> 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: Plugin - Portlet
>            Reporter: Rickard Öberg
>            Assignee: Nils-Helge Garli
>            Priority: Critical
>             Fix For: 2.1.0, 2.0.10
>
>
> 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.


[jira] Reopened: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nils-Helge Garli reopened WW-2101:
----------------------------------


Adding classes back and deprecating.

> 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: Plugin - Portlet
>            Reporter: Rickard Öberg
>            Assignee: Nils-Helge Garli
>            Priority: Critical
>             Fix For: 2.0.10, 2.1.0
>
>
> 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.


[jira] Commented: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43050#action_43050 ] 

Nils-Helge Garli commented on WW-2101:
--------------------------------------

It was unfortunate that this was not mentioned in the release notes. The reason they had to be removed is described in this issue. Simply removing them is ok. They are not needed anymore. I'll try to remember to include this in the release notes of the next version.

Sorry for the inconvenience.

> 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: Plugin - Portlet
>            Reporter: Rickard Öberg
>            Assignee: Nils-Helge Garli
>            Priority: Critical
>             Fix For: 2.0.10, 2.1.0
>
>
> 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.


[jira] Reopened: (WW-2101) PreparatorServlet causes request and response objects to be used outside of service() method

Posted by "Rene Gielen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rene Gielen reopened WW-2101:
-----------------------------

      Assignee: Rene Gielen  (was: Nils-Helge Garli)

> 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
>            Assignee: Rene Gielen
>            Priority: Critical
>             Fix For: 2.1.0
>
>
> 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.