You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org> on 2008/10/13 21:30:44 UTC

[jira] Closed: (TAP5-257) NPE in RequestFilter if ApplicationStateManager is used

     [ https://issues.apache.org/jira/browse/TAP5-257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAP5-257.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 5.0.16

> NPE in RequestFilter if ApplicationStateManager is used
> -------------------------------------------------------
>
>                 Key: TAP5-257
>                 URL: https://issues.apache.org/jira/browse/TAP5-257
>             Project: Tapestry 5
>          Issue Type: Bug
>            Reporter: Francois Armand
>            Assignee: Howard M. Lewis Ship
>             Fix For: 5.0.16
>
>
> If one builds a request filter that use ApplicationStateManager, a call to any intersting method of the ASM throws an NPE.
> The problem is that the ApplicationStateManager use the session as default storage strategy, and that he tries to take it trough the RequesGlobals#getRequest that returns null in the request handler. 
> It's an expected behavior since the RequestGlobals#storeRequestResponse method is called in the *terminator* of the RequestFilter pipeline. Perhpas there is a good reason to do it so, and not in the head of the pipeline, but I don't see it.
> Notice: it's exactly the same thing for HttpRequest/HttpResponse and HttpServletRequestHandler and storeServletRequestResponse
> Workaround : contribute a RequestFilter before any other whose sole action is to set Request/Response:
> public static RequestFilter buildSetRequestResponse(final RequestGlobals requestGlobals) {
> 	return new RequestFilter(){
> 		public boolean service(Request request, Response response, RequestHandler handler) throws IOException {
> 			requestGlobals.storeRequestResponse(request, response);
> 			return handler.service(request, response);
> 		}
> 	};
> }
> public static void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
> 		@InjectService("setRequestResponse") RequestFilter setRequestResponse,
> 		...other filters...) {
> 		configuration.add("setRequestResponse", setRequestResponse, "before:*");
> 		...other configurations...
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org