tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich Stärk (JIRA) <j...@apache.org>
Subject [jira] Commented: (TAP5-456) NPE in HttpServletRequestFilter if ApplicationStateManager is used
Date Thu, 22 Jan 2009 10:43:59 GMT

    [ https://issues.apache.org/jira/browse/TAP5-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666117#action_12666117
] 

Ulrich Stärk commented on TAP5-456:
-----------------------------------

A workaround is to write a HttpServletRequestFilter that stores these objects into the RequestGlobals
service and place it at the very beginning of the pipeline:

{{
public static HttpServletRequestFilter buildSetHttpServletRequestResponse(
        final RequestGlobals requestGlobals,
        @Inject @Symbol(SymbolConstants.CHARSET) final String applicationCharset)
{
    return new HttpServletRequestFilter()
    {

        public boolean service(HttpServletRequest servletRequest,
                HttpServletResponse servletResponse, HttpServletRequestHandler handler)
                throws IOException
        {

            requestGlobals.storeServletRequestResponse(servletRequest, servletResponse);
            
            Request request = new RequestImpl(servletRequest, applicationCharset);
            
            Response response = new ResponseImpl(servletResponse);
            
            requestGlobals.storeRequestResponse(request, response);

            return handler.service(servletRequest, servletResponse);
        }
    };
}
}}

{{
public static void contributeHttpServletRequestHandler(
        OrderedConfiguration<HttpServletRequestFilter> configuration,
        @InjectService("setHttpServletRequestResponse") HttpServletRequestFilter setRequestResponse)
{
    configuration.add("setHttpServletRequestResponse", setRequestResponse, "before:*");
}
}}


> NPE in HttpServletRequestFilter if ApplicationStateManager is used
> ------------------------------------------------------------------
>
>                 Key: TAP5-456
>                 URL: https://issues.apache.org/jira/browse/TAP5-456
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.18
>            Reporter: Ulrich Stärk
>
> The same problem as described in TAP5-257 holds true for the HttpServletRequestHandler
pipeline. If a filter wants to store or retrieve something from the ApplicationStateManager,
a NPE is thrown because HttpServletRequest, HttpServletResponse, Request and Response are
not stored in the RequestGlobals yet. A workaround is to write a HttpServletRequestFilter
that stores these objects into the RequestGlobals service and place it at the very beginning
of the pipeline.

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


Mime
View raw message