jersey
  1. jersey
  2. JERSEY-1431

com.sun.jersey.spi.container.ContainerResponseFilters is misleading when used with FEATURE_FILTER_FORWARD_ON_404

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 1.14
    • Fix Version/s: 1.x-backlog
    • Component/s: containers
    • Labels:
      None

      Description

      The com.sun.jersey.spi.container.ContainerResponseFilters feature is misleading when used in conjunction with FEATURE_FILTER_FORWARD_ON_404.

      I spent almost an entire day trying to figure out why a unit test was getting HTTP 405 from a resource that returned HTTP 404. It turns out that FEATURE_FILTER_FORWARD_ON_404 was enabled and Grizzly returns HTTP 405 for unknown URLs (which seems a bug in its own right).

      Here is what the server-side and client-side logs showed:

      Sep 23, 2012 5:07:59 AM com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller createResource
      FINEST: A new abstract resource created by IntrospectionModeler: AbstractResource(UsersResource: 1 constructors, 0 fields, 0 setter methods, 1 res methods, 0 subres methods, 1 subres locators )
      Sep 23, 2012 5:07:59 AM com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller createResource
      FINEST: A new abstract resource created by IntrospectionModeler: AbstractResource(UserResource: 1 constructors, 0 fields, 0 setter methods, 3 res methods, 0 subres methods, 1 subres locators )
      Sep 23, 2012 5:07:59 AM com.sun.jersey.api.container.filter.LoggingFilter$Adapter finish
      INFO: 3 * Server out-bound response
      3 < 404
      3 < Content-Type: application/x-com.holdmyspot.user+json; version=1
      3 < 
      
      Sep 23, 2012 5:07:59 AM com.sun.jersey.api.client.filter.LoggingFilter log
      INFO: 1 * Client in-bound response
      1 < 405
      1 < Date: Sun, 23 Sep 2012 09:07:59 GMT
      1 < Content-Length: 0
      1 < server: grizzly/2.2.4
      1 < Content-Type: application/x-com.holdmyspot.user+json; version=1
      1 < 
      

      Expected behavior: Server-side code should indicate that FEATURE_FILTER_FORWARD_ON_404 caused the response to be forwarded to a subsequent servlet filter, and it should report the final response that comes out of it.

        Issue Links

          Activity

          Hide
          Jakub Podlesak added a comment -

          Regarding the grizzly bug: please file your suggestion here: https://java.net/jira/browse/GRIZZLY

          Regarding the Jersey one, i am going to target the fix for 1.18, where we will make sure a CONFIG level
          message is written to the log at the application startup time saying that the FEATURE_FILTER_FORWARD_ON_404
          feature has been set (if that would be the case). I do not think it makes sense to log anything for each and every
          request.

          Show
          Jakub Podlesak added a comment - Regarding the grizzly bug: please file your suggestion here: https://java.net/jira/browse/GRIZZLY Regarding the Jersey one, i am going to target the fix for 1.18, where we will make sure a CONFIG level message is written to the log at the application startup time saying that the FEATURE_FILTER_FORWARD_ON_404 feature has been set (if that would be the case). I do not think it makes sense to log anything for each and every request.
          Hide
          cowwoc added a comment -

          The grizzly issue is here: GRIZZLY-1336

          The 405 is caused by a second Jersey bug, this time in the implementation of GrizzlyWebTestContainerFactory. See https://java.net/jira/browse/GRIZZLY-1336?focusedCommentId=346492&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_346492

          Can you please take a look at this?

          Show
          cowwoc added a comment - The grizzly issue is here: GRIZZLY-1336 The 405 is caused by a second Jersey bug, this time in the implementation of GrizzlyWebTestContainerFactory. See https://java.net/jira/browse/GRIZZLY-1336?focusedCommentId=346492&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_346492 Can you please take a look at this?
          Hide
          Jakub Podlesak added a comment -

          O.K., we need to update GrizzlyWebTestContainerFactory in addition to generating the CONFIG log message.

          Show
          Jakub Podlesak added a comment - O.K., we need to update GrizzlyWebTestContainerFactory in addition to generating the CONFIG log message.
          Hide
          Marek Potociar added a comment -

          Jersey 1.x branch is not under active development anymore. Only security issues and issues reported by the customers of commercially supported products that ship with Jersey are fixed on this code base right now.
          Please, move your code to Jersey 2.x and if you still see the issue there, feel free to file a bug against Jersey 2.x.

          Show
          Marek Potociar added a comment - Jersey 1.x branch is not under active development anymore. Only security issues and issues reported by the customers of commercially supported products that ship with Jersey are fixed on this code base right now. Please, move your code to Jersey 2.x and if you still see the issue there, feel free to file a bug against Jersey 2.x.

            People

            • Assignee:
              Unassigned
              Reporter:
              cowwoc
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: