[
https://issues.apache.org/jira/browse/FELIX-6873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul Rütter closed FELIX-6873.
------------------------------
> HTTP Base: ERROR-dispatch URL-pattern filters are matched against the
> original request URI instead of the error servlet’s path
> ------------------------------------------------------------------------------------------------------------------------------
>
> Key: FELIX-6873
> URL: https://issues.apache.org/jira/browse/FELIX-6873
> Project: Felix
> Issue Type: Bug
> Components: HTTP Service
> Affects Versions: http.base-6.0.2
> Reporter: Paul Rütter
> Assignee: Paul Rütter
> Priority: Minor
> Fix For: http.jetty12-1.2.10, http.jetty12-2.0.10, http.base-6.0.4
>
>
> h3. Problem
> When a response calls {{sendError()}} and an error servlet is registered for
> that status code, {{ServletResponseWrapper.sendError()}} selects the error
> servlet and then collects the ERROR-dispatch filters with:
> {code:java}
> errorRegistry.getFilterHandlers(errorResolution, DispatcherType.ERROR,
> request.getRequestURI())
> {code}
> {{request.getRequestURI()}} is the URI of the *original request* that
> triggered the error. {{FilterRegistry.getFilterHandlers()}} matches URL
> patterns against that URI, and matches servlet names against the selected
> error servlet separately.
> As a result, an ERROR filter with a URL pattern only applies if the original
> request matches the pattern, not if the error servlet does.
> h3. Example
> * Error servlet {{errorPage}}, pattern {{/errors/page}}, {{errorPage=404}}
> * ERROR filter with pattern {{/errors/*}}
> * A 404 originating at {{/errors/missing}} runs the filter.
> * A 404 originating at {{/missing}} does not, although the error servlet at
> {{/errors/page}} is invoked.
> This is inconsistent with FORWARD and INCLUDE dispatch in
> {{RequestDispatcherImpl}}, which match filters against the target's path, and
> with servlet containers, which match ERROR filters against the error page
> location.
> Servlet-name ERROR filters are not affected.
> h3. Expected behaviour
> ERROR URL-pattern filters are matched against the path of the selected error
> servlet, consistent with FORWARD/INCLUDE and the Servlet specification. An
> error servlet registered without a pattern is only matched by servlet-name
> filters.
> h3. Notes
> * Behaviour change: ERROR filters that currently rely on matching the
> original request URI will stop matching. This should be mentioned in the
> release notes.
> * Needs tests for ERROR dispatch with URL-pattern filters: error servlet with
> one pattern, several patterns, and none.
> * Bundles that embed HTTP Base (e.g. the Jetty bundles) pick up the fix with
> their next release.
> * Reported by hataehoon (GitHub: dpfkdlemtp).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)