Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5973

Response.created(URI) resolves relative URIs relative to the servlet URI instead of the request URI

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.7.5, 2.7.12
    • Fix Version/s: None
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      According to the JavaDoc of javax.ws.rs.core.Response.created(URI), relative URIs should be resolved relative to the request URI.

      However, CXF resolves the URI relative the the servlet path of the CXFNonSpringJaxrsServlet.

      Example:
      For a resource at path /account/someaccount/entries served by a servlet registered at /service/b/api, the following code should result in a response with the HTTP header Location: http://localhost/service/b/api/account/someaccount/entries/newentry

          @POST
          public Response create() {
              URI location = new URI("newentry");
              return Response.created(location).build();
          }
      

      However, the header has the incorrect value Location: http://localhost/service/b/api/newentry

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tobias.oberlies Tobias Oberlies
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: