Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-13909

[GSS](7.1.z) RESTEASY-1763 - Wrong request matching to literal path

    XMLWordPrintable

Details

    • EAP 7.1.1

    Description

      JAX-RS 2 spec section 2.3.7 2(f), 2(g) and 2(h)steps. 2(h) should filter the methods removing the regex ones and keep only the literal and it does not seen to be respected. Let's say we have the following JAX-RS resource:

      @Path("resource")
      public class Resource {
      
      	@GET
      	@Path("{type}")
      	public Object get(@PathParam("type") String type) throws Exception {
      		return "{type} invoked";
      	}
      
      	@GET
      	@Path("other")
      	@Produces(MediaType.APPLICATION_XML)
      	public Response other() {
      		return Response.ok("other invoked").build();
      	}
      
      }
      

      Trying to request application/xml with a q parameter will work:

      $ curl -H 'Accept: application/xml;q=0.9' http://localhost:8080/web-app-context/resource/other
      other invoked
      

      However, if we add text/plain it will invoke the method get:

      $ curl -H 'Accept: text/plain, application/xml;q=0.9' http://localhost:8080/web-app-context/resource/other
      {type} invoked
      

      As said, JAX-RS 2 spec section 2.3.7 2(f), 2(g) and 2(h)steps is related to the method matching. 2(h) should filter the methods removing the regex ones and keep only the literal, in our case, at this step we hope that "

      {plain}

      " is removed and only "other" is kept because the list of regex was sorted based on the number of literals (see 2(f)). E is the list of regex, and then we have Rmatch, which is "Set Rmatch to be the first member of E". Next, in 2(h) we have:

      **M =

      {sub-resource methods D of all classes in C' where Rmatch = R(TD)}

      **

      it says =, not matches, so my understanding is that it throws away

      {type} (method get) from the list of M. After this it will go to the part that checks the content type and, as you can see in my resource above, {type}

      seems to be still part of this.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-asoldano Alessio Soldano
              rhn-support-wsiqueir William Siqueira
              Peter Mackay Peter Mackay
              Peter Mackay Peter Mackay
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: