Class ContainerProvider

java.lang.Object
javax.websocket.ContainerProvider

public abstract class ContainerProvider
extends java.lang.Object
Provider class that allows the developer to get a reference to the implementation of the WebSocketContainer. The provider class uses the ServiceLoader to load an implementation of ContainerProvider. Specifically, the fully qualified class name of the container implementation of ContainerProvider must be listed in the "META-INF/services/javax.websocket.ContainerProvider" file in the implementation JAR file.
Author:
dannycoward
  • Constructor Summary

    Constructors 
    Constructor Description
    ContainerProvider()  
  • Method Summary

    Modifier and Type Method Description
    protected abstract WebSocketContainer getContainer()
    Create a new instance of the the WebSocket container implementation.
    static WebSocketContainer getWebSocketContainer()
    Obtain a new instance of a WebSocketContainer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getWebSocketContainer

      public static WebSocketContainer getWebSocketContainer()
      Obtain a new instance of a WebSocketContainer. The method looks for the ContainerProvider implementation class in the order listed in the "META-INF/services/javax.websocket.ContainerProvider" file, returning the first WebSocketContainer implementation from the ContainerProvider implementation that is not null.
      Returns:
      an implementation provided instance of type WebSocketContainer
    • getContainer

      protected abstract WebSocketContainer getContainer()
      Create a new instance of the the WebSocket container implementation.
      Returns:
      the new instance