[
https://issues.apache.org/jira/browse/TAP5-257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639168#action_12639168
]
Howard M. Lewis Ship commented on TAP5-257:
-------------------------------------------
What we can do is put the *initial* request/response into RequestGlobals at the
start of the pipeline, then update it again at the end of the pipeline.
> 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
>
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]