tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francois Armand (JIRA)" <j...@apache.org>
Subject [jira] Created: (TAP5-257) NPE in RequestFilter if ApplicationStateManager is used
Date Wed, 08 Oct 2008 07:49:44 GMT
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

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

View raw message