jersey
  1. jersey
  2. JERSEY-768

Explore automatic URI configuration of a WebResource instance based on the provided annotated Resource class

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.9
    • Fix Version/s: 2.0
    • Component/s: test-framework
    • Labels:
      None

      Description

      Why not having a Client.create(Class) or Client.create(Class, String method) way to create WebResource? This would allow to obtain URI information from annotated ResourceClasses. That way a vendor could provide a JAR with those to the client application developer reducing the need to know the pattern of the URIs. This is particularly useful if server and client application are implemented by the same team, as it might be the case for in-house applications. Obtaining the correct URI pattern is a real pain with JAX-RS 1 currently, so this could be rather useful.

        Activity

        Hide
        Marek Potociar added a comment -

        After discussing with Santiago, I tend to agree that such feature would promote a tight coupling between client and server side, which is obviously directly opposing one of the main attributes that RESTful architectures are striving to achieve. Therefore it seems that it would be a mistake to add the feature into JAX-RS API.

        Nevertheless, I see the practical side of it and such feature may be quite useful in testing a developed RESTful application. I am therefore going to convert the sub-task to a standalone issue and move it to Jersey, where the RFE should be considered wrt. Jersey test framework client API.

        Show
        Marek Potociar added a comment - After discussing with Santiago, I tend to agree that such feature would promote a tight coupling between client and server side, which is obviously directly opposing one of the main attributes that RESTful architectures are striving to achieve. Therefore it seems that it would be a mistake to add the feature into JAX-RS API. Nevertheless, I see the practical side of it and such feature may be quite useful in testing a developed RESTful application. I am therefore going to convert the sub-task to a standalone issue and move it to Jersey, where the RFE should be considered wrt. Jersey test framework client API.
        Hide
        Marek Potociar added a comment -

        Updated severity and component

        Show
        Marek Potociar added a comment - Updated severity and component
        Hide
        Martin Matula added a comment - - edited

        Are you trying to achieve more than what UriBuilder.fromResource() already does? I guess I don't see a need.

        Show
        Martin Matula added a comment - - edited Are you trying to achieve more than what UriBuilder.fromResource() already does? I guess I don't see a need.
        Hide
        Marek Potociar added a comment -

        I guess the only potential benefit for consideration is the ability to shortcut this:

        Target t = client.target(baseApplicationUri).path(UriBuilder.fromUri(MyResource.class));

        Into this:

        Target t = client.target(baseApplicationUri, MyResource.class);

        Or this:

        Target t = client.target(baseApplicationUri).path(MyResource.class);

        The above could be provided as TestClient and TestTarget extensions to JAX-RS Client and Target.

        Show
        Marek Potociar added a comment - I guess the only potential benefit for consideration is the ability to shortcut this: Target t = client.target(baseApplicationUri).path(UriBuilder.fromUri(MyResource.class)); Into this: Target t = client.target(baseApplicationUri, MyResource.class); Or this: Target t = client.target(baseApplicationUri).path(MyResource.class); The above could be provided as TestClient and TestTarget extensions to JAX-RS Client and Target.
        Hide
        Marek Potociar added a comment -

        The JAX-RS API will provide enough utility methods via UriBuilder as well as Link.

        Show
        Marek Potociar added a comment - The JAX-RS API will provide enough utility methods via UriBuilder as well as Link.

          People

          • Assignee:
            Marek Potociar
            Reporter:
            Marek Potociar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: