Skip to content

Use undecoded path for request mapping in WebFlux [SPR-15640] #20199

Closed

Description

@spring-projects-issues

Rossen Stoyanchev opened SPR-15640 and commented

Status Quo

By default Spring MVC decodes the path before using it for request mapping purposes. In turn that means @RequestMapping patterns can be expressed in undecoded form. This works just fine until the path contains encoded characters with reserved URI meaning such as a "/" or ";" where decoding alters the structure of the path. Applications can configure a UrlPathHelper that does not decode the URL path which works fine and in that case URI variables are automatically decoded before being injected into a controller with @PathVariable. However the literal parts of mapping patterns must now be expressed with encoded characters.

WebFlux

In WebFlux the URL path will not be decoded for request mapping purposes. Patterns can still be expressed in undecoded form but will be encoded as UTF-8 and stored that way to match to the encoded URL path of incoming requests. This eliminates the need to specify whether the path should be decoded or not along exposure to issues that can arise from decoding the path.

Spring MVC

Since support for encoding patterns will likely be in the new PathPatternParser - used by default in WebFlux, this will be a natural fit for WebFlux. The goal for Spring MVC is for applications to be able to achieve the same affect by switching to use the PathPatternParser.


Sub-tasks:

Issue Links:

Activity

  1. added
    type: enhancement
    in: web
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions