Class WSUtil
java.lang.Object
org.eclipse.net4j.ws.WSUtil
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic IWSAcceptorgetAcceptor(org.eclipse.net4j.util.container.IManagedContainer container, String acceptorName) Gets the WS acceptor product for the given name.static IWSConnectorgetConnector(org.eclipse.net4j.util.container.IManagedContainer container, String description) Creates or retrieves a connector product for a previously encoded description.static IWSConnectorgetConnector(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 StringgetConnectorDescription(String serviceURI, String acceptorName, String... arguments) Encodes a string URI and route name as a connector factory description.static StringgetConnectorDescription(URI serviceURI, String acceptorName, String... arguments) Encodes a service URI and acceptor route as a connector factory description.static voidprepareContainer(org.eclipse.net4j.util.container.IManagedContainer container) Deprecated.
-
Field Details
-
FACTORY_TYPE
- See Also:
-
-
Method Details
-
prepareContainer
@Deprecated public static void prepareContainer(org.eclipse.net4j.util.container.IManagedContainer container) Deprecated.Containers created viaContainerUtil.createInitializedContainer()orOMPlatform.createManagedContainer()are initialized automatically. Advanced callers configuring a raw container can useOMBundle.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 productacceptorName- registered route name- Returns:
- the acceptor product
- Throws:
org.eclipse.net4j.util.container.FactoryNotFoundException- if the WS acceptor factory is not registeredorg.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 factoriesdescription- 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 factoriesserviceURI- base WebSocket service URIacceptorName- target acceptor routearguments- 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 URIacceptorName- target acceptor routearguments- provider or handshake arguments- Returns:
- connector factory description
- Throws:
URISyntaxException- ifserviceURIis 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 URIacceptorName- target acceptor routearguments- 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
-
ContainerUtil.createInitializedContainer()orOMPlatform.createManagedContainer()are initialized automatically.