Class WSUtil

java.lang.Object
org.eclipse.net4j.ws.WSUtil

public final class WSUtil extends Object
Creates and describes WebSocket connectors and retrieves WebSocket acceptors from managed containers.

Connector descriptions identify the transport endpoint and named acceptor, followed by escaped provider-specific arguments. The provider type is selected through the message-connection factory product group; the WS connector owns the Net4j scheduling and framing layer, while that provider owns handshake configuration and transport I/O.

Author:
Eike Stepper
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getAcceptor(org.eclipse.net4j.util.container.IManagedContainer container, String acceptorName)
    Gets the WS acceptor product for the given name.
    getConnector(org.eclipse.net4j.util.container.IManagedContainer container, String description)
    Creates or retrieves a connector product for a previously encoded description.
    getConnector(org.eclipse.net4j.util.container.IManagedContainer container, URI serviceURI, String acceptorName, String... arguments)
    Creates a connector product for a service URI, acceptor route, and optional provider arguments.
    static String
    getConnectorDescription(String serviceURI, String acceptorName, String... arguments)
    Encodes a string URI and route name as a connector factory description.
    static String
    getConnectorDescription(URI serviceURI, String acceptorName, String... arguments)
    Encodes a service URI and acceptor route as a connector factory description.
    static void
    prepareContainer(org.eclipse.net4j.util.container.IManagedContainer container)
    Deprecated.
    Containers created via ContainerUtil.createInitializedContainer() or OMPlatform.createManagedContainer() are initialized automatically.

    Methods inherited from class Object

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

  • Method Details

    • prepareContainer

      @Deprecated public static void prepareContainer(org.eclipse.net4j.util.container.IManagedContainer container)
      Deprecated.
      Containers created via ContainerUtil.createInitializedContainer() or OMPlatform.createManagedContainer() are initialized automatically. Advanced callers configuring a raw container can use OMBundle.prepareContainer(IManagedContainer).
    • getAcceptor

      public static IWSAcceptor getAcceptor(org.eclipse.net4j.util.container.IManagedContainer container, String acceptorName)
      Gets the WS acceptor product for the given name. The container may create and activate the product if it does not already exist.
      Parameters:
      container - container that owns the acceptor product
      acceptorName - registered route name
      Returns:
      the acceptor product
      Throws:
      org.eclipse.net4j.util.container.FactoryNotFoundException - if the WS acceptor factory is not registered
      org.eclipse.net4j.util.factory.ProductCreationException - if the container cannot create or activate the product
    • getConnector

      public static IWSConnector getConnector(org.eclipse.net4j.util.container.IManagedContainer container, String description)
      Creates or retrieves a connector product for a previously encoded description.
      Parameters:
      container - container that owns the connector and provider factories
      description - connector factory description
      Returns:
      the configured connector
    • getConnector

      public static IWSConnector getConnector(org.eclipse.net4j.util.container.IManagedContainer container, URI serviceURI, String acceptorName, String... arguments)
      Creates a connector product for a service URI, acceptor route, and optional provider arguments.
      Parameters:
      container - container that owns the connector and message-connection provider factories
      serviceURI - base WebSocket service URI
      acceptorName - target acceptor route
      arguments - escaped provider or handshake arguments
      Returns:
      the configured connector
      Since:
      1.3
    • getConnectorDescription

      public static String getConnectorDescription(String serviceURI, String acceptorName, String... arguments) throws URISyntaxException
      Encodes a string URI and route name as a connector factory description.
      Parameters:
      serviceURI - base WebSocket service URI
      acceptorName - target acceptor route
      arguments - provider or handshake arguments
      Returns:
      connector factory description
      Throws:
      URISyntaxException - if serviceURI is not a valid URI
      Since:
      1.3
    • getConnectorDescription

      public static String getConnectorDescription(URI serviceURI, String acceptorName, String... arguments)
      Encodes a service URI and acceptor route as a connector factory description.
      Parameters:
      serviceURI - base WebSocket service URI
      acceptorName - target acceptor route
      arguments - provider or handshake arguments; CR and LF are rejected because the description uses line-based compatibility syntax
      Returns:
      connector factory description understood by the WS connector factory
      Throws:
      IllegalArgumentException - if an argument contains CR or LF
      Since:
      1.3