Recreation - RESTEasy cutting trailing slash @Path

RESTEasy tries to ignore the trailing slash, so I cannot write two different web services with and without trailing slash, and this example shows:

@Path("foo") public class TestClass { @GET @Path("/bar") public Response bar1() { ... } @GET @Path("/bar/") public Response bar2() { ... } } 

With RESTEasy, the GET request in / foo / bar as well as / foo / bar / is handled by bar2 (). Given the RFC3986 and JAX-RS Spec, I don’t understand why this is happening like this. Could this be a problem with RESTEasy or is there something I'm watching over?

+4
source share
1 answer

Here is what the JAX-RS specification says

3.7 Compliance of requests to resource methods

3.7.3 Converting URI patterns to regular expressions

  • The URI encodes the template, ignoring the specification of the URI template variables.
  • Avoid any regex characters in the URI pattern, again ignoring the variable specification of the URI.
  • Replace each URI template variable with a capture group containing the specified regular expression, or "([^ /] +?) If no regular expression is specified.
  • If the resulting string ends with '/, then delete the final character .
  • Add '(/.*)? to the result.

As I read, RESTEasy implements the specification correctly.

+4
source

All Articles