jersey
  1. jersey
  2. JERSEY-1565

Path associated with PathParam behaves differently on having slash

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.9
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Environment:

      Windows7

      Description

      Open Empservice.java in the attached application. Focus on @DELETE and @POST. Both have a PathParam associated with them. Observe the @Path annotations on each of these methods.
      @DELETE has @Path("/

      {name}")
      @POST has @Path("{name}

      ")
      Note that the difference is the presence of slash in Path annotation corresponding to @POST.

      The snippet of WADL generated for these two operations is as below:

      <ns0:resource path="/

      {name}">
      <ns0:param name="name" style="template" xmlns:ns2="http://www.w3.org/2001/XMLSchema" type="ns2:string"/>
      <ns0:method id="deleteEmployee" name="DELETE">
      <ns0:response>
      <ns0:representation mediaType="/"/>

      </ns0:response>
      </ns0:method>
      </ns0:resource>
      <ns0:resource path="{name}

      ">
      <ns0:param name="name" style="template" xmlns:ns3="http://www.w3.org/2001/XMLSchema" type="ns3:string"/>
      <ns0:method id="updateEmployee" name="POST">
      <ns0:response>
      <ns0:representation mediaType="application/json"/>
      </ns0:response>
      </ns0:method>
      </ns0:resource>

      Here, as seen,

      {name} and /{name}

      are not treated as the same. However, as per the WADL spec, they are to be treated the same.

        Activity

        padbhat created issue -
        Martin Matula made changes -
        Field Original Value New Value
        Assignee Pavel Bucek [ pavel_bucek ]
        Libor Kramolis made changes -
        Tags e/japod
        Jakub Podlesak made changes -
        Assignee Pavel Bucek [ pavel_bucek ] Jakub Podlesak [ japod ]
        Hide
        Jakub Podlesak added a comment -

        The most obvious workaround for this is to stick with @Path("

        {name}

        ") annotation at both sub-resource methods.
        I am ready to re-evaluate if there would be more information provided why the above suggested workaround should not work.

        Show
        Jakub Podlesak added a comment - The most obvious workaround for this is to stick with @Path(" {name} ") annotation at both sub-resource methods. I am ready to re-evaluate if there would be more information provided why the above suggested workaround should not work.
        Jakub Podlesak made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]
        Jakub Podlesak made changes -
        Tags e/japod
        Hide
        trentadams added a comment -

        I've found that the following behave differently as well..

        @Path("/

        {securityToken}/register")

        For the above, the parameter is output in the wadl. For the one below, the wadl does not indicate that there is a securityToken path parameter. But, if I have the prefixed slash, an extra slash is there when concatenating the base resource and resource path. We use XSL for creating a test page, so it's important we see that parameter.

        @Path("{securityToken}

        /register")

        Would this likely be the same bug?

        Show
        trentadams added a comment - I've found that the following behave differently as well.. @Path("/ {securityToken}/register") For the above, the parameter is output in the wadl. For the one below, the wadl does not indicate that there is a securityToken path parameter. But, if I have the prefixed slash, an extra slash is there when concatenating the base resource and resource path. We use XSL for creating a test page, so it's important we see that parameter. @Path("{securityToken} /register") Would this likely be the same bug?

          People

          • Assignee:
            Jakub Podlesak
            Reporter:
            padbhat
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: