Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None

      Description

      This feature has been requested by a few reviewers. One challenge is around the configuration of the injected instance.

        Activity

        Hide
        patriot1burke added a comment -

        Looks pretty cool. I like it.

        The only problem I see is, how does a user create a Configuration? Right now because of the enable/disable methods, its quite a complex interface to implement. Configuration's complexity is something I complained about before.

        Show
        patriot1burke added a comment - Looks pretty cool. I like it. The only problem I see is, how does a user create a Configuration? Right now because of the enable/disable methods, its quite a complex interface to implement. Configuration's complexity is something I complained about before.
        Hide
        mkarg added a comment -

        While I actually like injection, I need to say that from the user's view

        Client client = ClientFactory.newClient();

        is much simpler than the lots of code above. So I cannot say that in your particular sample it would looks easy or simple to understand.

        Show
        mkarg added a comment - While I actually like injection, I need to say that from the user's view Client client = ClientFactory.newClient(); is much simpler than the lots of code above. So I cannot say that in your particular sample it would looks easy or simple to understand.
        Hide
        algermissen added a comment - - edited

        The @Uri("http://example.jax-rs.org/bar") proposal looks wrong to me because it encourages working against REST by hardcoding URIs instead of discovering them.

        Yes, you might argue that entry URIs (aka bookmarks) can be considered to be reasonably stable over time but for my taste, I'd like to see entry URIs to be placed in configurations.

        @Uri seems like the client side equivalent to the REST anti pattern of providing service API documentation instead of media type specs.

        I favor Client injection.

        UPDATE:

        What about doing this analog to JPA? The configuration of a bunch of clients could be placed into a configuration file and one could obtain an instances my referring to the configuration name:

        @ClientUnit(configName="myConfig")
        private Client client;

        @ClientUnit(configName="longTimeoutConfig")
        private Client longTimingOutClient;

        Show
        algermissen added a comment - - edited The @Uri("http://example.jax-rs.org/bar") proposal looks wrong to me because it encourages working against REST by hardcoding URIs instead of discovering them. Yes, you might argue that entry URIs (aka bookmarks) can be considered to be reasonably stable over time but for my taste, I'd like to see entry URIs to be placed in configurations. @Uri seems like the client side equivalent to the REST anti pattern of providing service API documentation instead of media type specs. I favor Client injection. UPDATE : What about doing this analog to JPA? The configuration of a bunch of clients could be placed into a configuration file and one could obtain an instances my referring to the configuration name: @ClientUnit(configName="myConfig") private Client client; @ClientUnit(configName="longTimeoutConfig") private Client longTimingOutClient;
        Hide
        Marek Potociar added a comment - - edited

        Jan, while I like your suggestion I think it's too late now to just start thinking about a deployment descriptor file format for JAX-RS 2.0. Also, I don't see a problem with specifying URIs as part of the @Uri annotations, since you can specify a template, not a final absolute uri - as with the client API.

        Perhaps we need to take a step back and do a minimalistic initial support first in JAX-RS 2.0 as follows:

        1. Keep the @Uri annotation with support of URI templates (as it is supported in the client API anyway)
          • the injected WebTarget instance would be configured with all the application providers & features
          • implementations MAY provide ways of supporting the different configs or mappings between config properties and URI template variables
        2. Extend @Provider annotation to be able to specify a provider "affinity" to the client or server side (or both = default).

        I changed my mind wrt. reusing @Provider annotation as it would further complicate the potential unwanted leaks of library provider classes into applications that use class-path scanning JAX-RS mechanism. We should create a new annotation for this purpose instead.

        Show
        Marek Potociar added a comment - - edited Jan, while I like your suggestion I think it's too late now to just start thinking about a deployment descriptor file format for JAX-RS 2.0. Also, I don't see a problem with specifying URIs as part of the @Uri annotations, since you can specify a template, not a final absolute uri - as with the client API. Perhaps we need to take a step back and do a minimalistic initial support first in JAX-RS 2.0 as follows: Keep the @Uri annotation with support of URI templates (as it is supported in the client API anyway) the injected WebTarget instance would be configured with all the application providers & features implementations MAY provide ways of supporting the different configs or mappings between config properties and URI template variables Extend @Provider annotation to be able to specify a provider "affinity" to the client or server side (or both = default). I changed my mind wrt. reusing @Provider annotation as it would further complicate the potential unwanted leaks of library provider classes into applications that use class-path scanning JAX-RS mechanism. We should create a new annotation for this purpose instead.
        Hide
        Marek Potociar added a comment -
        • New @ConstrainedTo annotation has been added to the API.
        • @Uri javadoc was updated to explicitly mention use of URI templates.
        Show
        Marek Potociar added a comment - New @ConstrainedTo annotation has been added to the API. @Uri javadoc was updated to explicitly mention use of URI templates.

          People

          • Assignee:
            Marek Potociar
            Reporter:
            Santiago Pericas-Geertsen
          • Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 3 hours
              3h