Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller fails to map for URLs patterns containing semicolons [SPR-16005] #20554

Closed
spring-issuemaster opened this issue Sep 25, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Sep 25, 2017

Konstantin Chernov opened SPR-16005 and commented

We use Spring WebFlux 5.0 RC4 in our project. We have semicolon format URLs like

http:/server_url/command;t=param1;param2

Controller worked with annotation

@GetMapping(path="/command;{params}") public Mono<ResponseEntity<Flux<DataBuffer>>> getSpecificChannels(@PathVariable String params) in Spring WebFlux version 5.0.0.m5

Now I'm getting

Response status 404 with reason "No matching handler" If semicolon is removed from URL then method is mapped but variable params is empty


Affects: 5.0 RC4

Referenced from: commits ab92754

1 votes, 3 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 27, 2017

Rossen Stoyanchev commented

This is a consequence of the PathPattern using the new RequestPath for path matching and matching directly to path segment values -- decoded and with semicolon content removed. I'm setting the fix version to 5.0.1 to give us a little time to figure out the best way to fix this.

In the mean time with the ";" removed the mapping works (as you said) and the underlying information is actually there. The HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE attribute is set to a multivalue map with path variable names as keys.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 28, 2017

Konstantin Chernov commented

Thanks for your comment. I will check how it works with MATRIX_VARIABLES_ATTRIBUTE. As a workaround we updated pattern to /command* and used ServerHttpRequest to match URL params in a method body

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 19, 2017

Rossen Stoyanchev commented

Konstantin Chernov, as I mentioned earlier, in Webflux we match to path segments with path parameters removed. That means URI variables do not contain path segments which is actually the same behavior as in Spring MVC except for the case where the URI variable is after the semicolon, e.g. "/command;{params}".

My plan is to add the @MatrixVariable argument resolvers to WebFlux since we already have that information ready, and just need to expose it through argument resolvers. That will include access to both individual values and a Map of all values, as well as referring to a specific path segment by URI variable name -- i.e. the full extent of support as what is available for Spring MVC.

I will go ahead and add that since we need it anyway. Will it work for you?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 20, 2017

Rossen Stoyanchev commented

Support for @MatrixVariable is now available in master. I am marking this resolved but feel free to comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.