Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3291

An endpoint with 2 or more @PathParam parameters will always be encoded

    XMLWordPrintable

Description

    The change made in RESTEASY-2845 breaks clients that have a method with more than 1 path param in the template as they will ALWAYS be encoded (i.e. / will be replaced) - even if you do not want it.

    Here is an example trait that has 2 path params and it worked fine until recent upgrade. It seems that as of this PR it will always encode '/' in id path param:

     

    @Path("something")
    @Consumes(Array(MediaType.APPLICATION_JSON))
    @Produces(Array(MediaType.APPLICATION_JSON))
    trait Resource { 
    
    @POST
    @Path("{id:.+}/commands/{commandId:.+}/confirm")
    def confirmCommand(@PathParam("id") id: String, @PathParam("commandId") commandId: String): Response
    }

    There is also @Encoded and PathParamProcessor but it looks like they have no impact after the following change was done as part of this ticket:

    // in org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker#createRequest:
    
    if (pathParamsMap.size() > 1) {
       target = target.resolveTemplates(pathParamsMap);
    } 

    why is > 1 a special case here? If path param has to be encoded then condition should be > 0?

    Other than that, how can one instruct it not to encode pathparam?

     

     

    Attachments

      Issue Links

        Activity

          People

            jperkins-rhn James Perkins
            jperkins-rhn James Perkins
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: