2

I'm in a Spring WebFlux context and i'm trying to use the double wildcard mapping feature.

As the documentation says (https://docs.spring.io/spring/docs/5.0.0.RELEASE/spring-framework-reference/web-reactive.html#webflux-ann-requestmapping-uri-templates)

Double wildcard should match any path segment. With this mapping value /**/c-{someId} I expect to match all of this:

  • /c-123456
  • /foo/c-123456
  • /foo/bar/c-123456

Actually, it's matching one and only one path segment -> /foo/c-123456

Is there any solution ? Or should I report a issue ?

1 Answers1

0

It's working as expected, since ** is meant to match zero or more path segments until the end of the path (see PathPattern Javadoc). So /**/c-{someId} is an illegal pattern here.

You can open an issue or even better, contribute an improvement on the reference documentation.

I'm not aware of any way to match all requests with a pattern like that unfortunately.

Brian Clozel
  • 56,583
  • 15
  • 167
  • 176
  • Thanks for your answer ! I understand the fact that it is an illegal pattern since `**` match `zero or more path segments until the end of the path`. But, it actually works fine in a Spring MVC context. Do you know why ? – LOUIS DUMONT Nov 08 '18 at 09:27
  • It works in Spring MVC because it's not using the same path matching algorithm. Spring MVC is using `PathMatcher` and Spring WebFlux is using `PathPattern` (a different, optimized implementation that's behaving differently) – Brian Clozel Nov 08 '18 at 16:22