Skip to content

Conversation

@jamesmissen
Copy link

This PR addresses issue #35882.

It does the following:

  1. Allows for ordering handlers based on path specificity, so handlers are selected based on how well a PathPattern matches the request path.

  2. Validates the HTTP status code for redirect handlers, using a simple assertion to check if the code is 3xx.

The changes are backwards compatible:

  1. A new useSpecificityOrder method is added to the Builder to opt in to specificity-based ordering. Not using this method (or using a value of false) results in the current behaviour.

  2. A new exclude method is added to the Builder to optionally exclude URL handling for specific patterns. Not using this method results in the current behaviour.

  3. For the servlet implementation, the parameter of the redirect method was changed from type HttpStatus to HttpStatusCode to align with the reactive implementation. This change will have no effect as HttpStatusCode is implemented by HttpStatus.

Feedback and edits are welcome, particularly regarding the implementation of specificity-based ordering, and the new method names (useSpecificityOrder and exclude).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 6, 2025
Signed-off-by: James Missen <88438228+jamesmissen@users.noreply.github.com>
Signed-off-by: James Missen <88438228+jamesmissen@users.noreply.github.com>
@jamesmissen jamesmissen force-pushed the jamesmissen/url-handler-filter branch from 1306db6 to 91c3bb0 Compare December 6, 2025 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants