websocket-spec
  1. websocket-spec
  2. WEBSOCKET_SPEC-83

Define the portability semantics of ContainerProvider

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      Spec needs to define the portability semantics of ContainerProvider API. At present, it is using a private and undocumented system property to load a provider in the RI's API. If this is the way a provider needs to be located (instead of much preferred ServiceLoader mechanism), this needs to be documented. Note that using a system property doesn't work for a web application that wants use a custom provider(by bundling the provider in a war file).

      Also, API's system property "websocket.clientcontainer.classname" is arbitrary. Usually, it is the class name in many other API, i.e "javax.websocket.ContainerProvider" in this case. WebSocketContainer class name for client container is also misleading.

        Activity

        jitu created issue -
        Hide
        Pavel Bucek added a comment - - edited

        ContainerProvider (as it is now) is basically unusable. Jitu covered it pretty well;

        better implmentation might look like ContainerProvider in Tyrus: http://java.net/projects/tyrus/sources/source-code-repository/content/trunk/core/src/main/java/org/glassfish/tyrus/javax/websocket/ContainerProvider.java?rev=275

        Show
        Pavel Bucek added a comment - - edited ContainerProvider (as it is now) is basically unusable. Jitu covered it pretty well; better implmentation might look like ContainerProvider in Tyrus: http://java.net/projects/tyrus/sources/source-code-repository/content/trunk/core/src/main/java/org/glassfish/tyrus/javax/websocket/ContainerProvider.java?rev=275
        Hide
        dannycoward added a comment -

        Yes I agree using the service loader would be a lot better.

        But the API class should not be looking for a Tyrus class as the default if no other can be found. If no provider implementation is configured, then there will be no provider.

        Thoughts ?

        Show
        dannycoward added a comment - Yes I agree using the service loader would be a lot better. But the API class should not be looking for a Tyrus class as the default if no other can be found. If no provider implementation is configured, then there will be no provider. Thoughts ?
        Hide
        Pavel Bucek added a comment -

        ServiceLoader can look for implementation of certain interface, it does not need to depend on that particular implementation.

        So.. you can look for javax.websocket.WebSocketContainer and if you have jar file with META-INF/services/javax.websocket.WebSocketContainer file with single line containing fully qualified name of your implementation of WebSocketContainer, it will be returned. See http://docs.oracle.com/javase/7/docs/api/java/util/ServiceLoader.html for more details.

        Show
        Pavel Bucek added a comment - ServiceLoader can look for implementation of certain interface, it does not need to depend on that particular implementation. So.. you can look for javax.websocket.WebSocketContainer and if you have jar file with META-INF/services/javax.websocket.WebSocketContainer file with single line containing fully qualified name of your implementation of WebSocketContainer, it will be returned. See http://docs.oracle.com/javase/7/docs/api/java/util/ServiceLoader.html for more details.
        Hide
        dannycoward added a comment -

        Yeah I know that. The example you posted looks for a particular Tyrus class if none is found from the service loader is what I was concerned about....

        Show
        dannycoward added a comment - Yeah I know that. The example you posted looks for a particular Tyrus class if none is found from the service loader is what I was concerned about....
        dannycoward made changes -
        Field Original Value New Value
        Due Date 2013-02-05 00:00:00.0
        Hide
        dannycoward added a comment -

        This has been updated to use the ServiceLoader.

        Show
        dannycoward added a comment - This has been updated to use the ServiceLoader.
        dannycoward made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee dannycoward [ dannycoward ]
        Tags v012
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            dannycoward
            Reporter:
            jitu
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Due:
              Created:
              Updated:
              Resolved: