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

JAX-RS Link implementation (LinkBuilder) looses context path

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.1
    • 3.0.2, 3.1
    • JAX-RS
    • None
    • Unknown

    Description

      I think I've discovered a bug in CXF, but I'm not sure. Link class
      messes links up, and doesn't include servlet and @ApplicationPath
      paths from BaseUri:

      Description:

      • I have CdiServlet deployed at '/rest',
      • I have Jax rs @ApplicationPath '/api'
      • Account resource at /account

      I expect the following code to return links to my resources:
      ~~~
      log.info(" – <<>> {}", uri.getBaseUri());
      return Response.ok().links(

      Link.fromResource(AccountResource.class).baseUri(uri.getBaseUri()).rel("account").build(),
      Link.fromResource(PlatformResource.class).baseUri(uri.getBaseUri()).rel("self").build()
      ).build();
      ~~~
      However, I get this on the client side:
      ~~~
      Link=[<http://localhost:9001/>;rel="self",
      <http://localhost:9001/account>;rel="account"],
      ~~~
      And I expected links with full path. like ttp://localhost:9001/rest/api/account

      UriInfo returns the correct uri. Link messes it up.
      ~~~
      INFO PlatformResource - – <<>> http://localhost:9001/rest/api
      ~~~

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            sergey_beryozkin Sergey Beryozkin
            ieugen Ioan Eugen Stan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment