Sling
  1. Sling
  2. SLING-1213

Filters to support servlet-API-level scope configuration

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Engine 2.2.0
    • Component/s: Engine
    • Labels:
      None

      Description

      Currently the filter.scope supports either

      • component (comparable to <dispatcher>INCLUDE,FORWARD,ERROR</dispatcher> of the servlet API)
        or
      • request (comparable to <dispatcher>REQUEST</dispatcher> of the servlet API)

      In certain cases one wants to have finer control over the filter scopes, e.g. have a filter that would do <dispatcher>REQUEST,FORWARD</dispatcher>, so that the filter is applied first for the request and then again when you do a requestDispatcher.forward().

      Therefore i suggest that the filter.scope should be enhanced as follows:

      • Make filter.scope a multi-value property
      • Add filter scopes: include, forward and error
      • The existing filter scope "component"(quasi an alias for "include,forward,error") should for backward-compatibility not change.
      • Add filter chains for the new filter scopes (don't know if this is needed internally?)

        Issue Links

          Activity

          Mike Pfaff created issue -
          Felix Meschberger made changes -
          Field Original Value New Value
          Link This issue blocks SLING-1140 [ SLING-1140 ]
          Hide
          Felix Meschberger added a comment -

          Attached a patch [1] to SLING-1603 which also includes an untested prototype implementation of this enhancement.

          [1] https://issues.apache.org/jira/secure/attachment/12453538/SLING-1603-fmeschbe.patch

          Show
          Felix Meschberger added a comment - Attached a patch [1] to SLING-1603 which also includes an untested prototype implementation of this enhancement. [1] https://issues.apache.org/jira/secure/attachment/12453538/SLING-1603-fmeschbe.patch
          Hide
          Carsten Ziegeler added a comment -

          Can you point to the changes regarding the filter handling? The patch is rather long
          Just noticed a typo in ServletFilterManager: the enum for request is just "Reques"

          Show
          Carsten Ziegeler added a comment - Can you point to the changes regarding the filter handling? The patch is rather long Just noticed a typo in ServletFilterManager: the enum for request is just "Reques"
          Hide
          Felix Meschberger added a comment -

          The changes to the filter handling are implied by the main refactoring of the SlingMainServlet. The extensions for more filter types is actually the list of FilterChainType enum values and an if statement handling backwards compatibility values.

          Thanks for noting the typo. I fixed it in my workspace code.

          Show
          Felix Meschberger added a comment - The changes to the filter handling are implied by the main refactoring of the SlingMainServlet. The extensions for more filter types is actually the list of FilterChainType enum values and an if statement handling backwards compatibility values. Thanks for noting the typo. I fixed it in my workspace code.
          Felix Meschberger made changes -
          Assignee Felix Meschberger [ fmeschbe ]
          Hide
          Felix Meschberger added a comment -

          Implemented support for the new filter scopes and defined respective constants in the EngineConstants class in Rev. 993280.

          The supported filter scopes are now:

          REQUEST – request level filters
          INCLUDE – filters only called on RequestDispatcher.include (also for jsp:include, and sling:include)
          FORWARD – filters only called on RequestDispatcher.forward (also for jsp:forward, and sling:forward)
          ERROR – filters only called handling status responses due to sendError and unhandled Throwables
          COMPONENT – filters called after REQUEST level filters and upon RequestDispatcher.forward and include

          Show
          Felix Meschberger added a comment - Implemented support for the new filter scopes and defined respective constants in the EngineConstants class in Rev. 993280. The supported filter scopes are now: REQUEST – request level filters INCLUDE – filters only called on RequestDispatcher.include (also for jsp:include, and sling:include) FORWARD – filters only called on RequestDispatcher.forward (also for jsp:forward, and sling:forward) ERROR – filters only called handling status responses due to sendError and unhandled Throwables COMPONENT – filters called after REQUEST level filters and upon RequestDispatcher.forward and include
          Felix Meschberger made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s Engine 2.1.2 [ 12315291 ]
          Resolution Fixed [ 1 ]
          Carsten Ziegeler made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow no-reopen-closed,doc-test-required [ 12483460 ] Copy of no-reopen-closed,doc-test-required [ 12764632 ]
          Gavin made changes -
          Workflow Copy of no-reopen-closed,doc-test-required [ 12764632 ] no-reopen-closed,doc-test-required [ 12766193 ]
          Gavin made changes -
          Link This issue blocks SLING-1140 [ SLING-1140 ]
          Gavin made changes -
          Link This issue is depended upon by SLING-1140 [ SLING-1140 ]
          Gavin made changes -
          Workflow no-reopen-closed,doc-test-required [ 12766193 ] re-open possible,doc-test-required [ 12790138 ]
          Gavin made changes -
          Workflow re-open possible,doc-test-required [ 12790138 ] no-reopen-closed,doc-test-required [ 12793131 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          279d 17h 21m 1 Felix Meschberger 07/Sep/10 09:51
          Resolved Resolved Closed Closed
          143d 16m 1 Carsten Ziegeler 28/Jan/11 09:07

            People

            • Assignee:
              Felix Meschberger
              Reporter:
              Mike Pfaff
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development