Tapestry 5
  1. Tapestry 5
  2. TAP5-257

NPE in RequestFilter if ApplicationStateManager is used


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0.16
    • Component/s: None
    • Labels:


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

        Issue Links


          No work has yet been logged on this issue.


            • Assignee:
              Howard M. Lewis Ship
              Francois Armand
            • Votes:
              3 Vote for this issue
              1 Start watching this issue


              • Created: