Spring WebFlux Controller Mapping Issues -Double Wildcard

921 Views Asked by At

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

There are 1 best solutions below

2
On

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.