javax.websocket
Interface WebSocketContainer


public interface WebSocketContainer

A WebSocketContainer is an implementation provided object that allows the developer to initiate a web socket handshake from the provided endpoint.

Since:
DRAFT 001
Author:
dannycoward

Method Summary
 Session connectToServer(Class<?> annotatedEndpointClass, URI path)
          Connect the supplied annotated object to its server.
 Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointConfiguration cec, URI path)
          Connect the supplied programmatic endpoint to its server with the given configuration.
 long getDefaultAsyncSendTimeout()
          Return the number of milliseconds the implementation will timeout attempting to send a websocket message for all RemoteEndpoints associated with this container.
 int getDefaultMaxBinaryMessageBufferSize()
          Returns the default maximum size of incoming binary message that this container will buffer.
 int getDefaultMaxTextMessageBufferSize()
          Returns the default maximum size of incoming text message that this container will buffer.
 Set<Extension> getInstalledExtensions()
          Return the set of Extensions installed in the container.
 long getMaxSessionIdleTimeout()
          Return the maximum time in milliseconds that a web socket session may be idle before the container may close it.
 void setAsyncSendTimeout(long timeoutmillis)
          Sets the number of milliseconds the implementation will timeout attempting to send a websocket message for all RemoteEndpoints associated with this container.
 void setDefaultMaxBinaryMessageBufferSize(int max)
          Sets the default maximum size of incoming binary message that this container will buffer.
 void setDefaultMaxTextMessageBufferSize(int max)
          Sets the maximum size of incoming text message that this container will buffer.
 void setMaxSessionIdleTimeout(long timeout)
          Sets the maximum time that a web socket session may be idle before the container may close it.
 

Method Detail

getDefaultAsyncSendTimeout

long getDefaultAsyncSendTimeout()
Return the number of milliseconds the implementation will timeout attempting to send a websocket message for all RemoteEndpoints associated with this container. A non-positive number indicates the implementation will not timeout attempting to send a websocket message asynchronously. Note this default may be overridden in each RemoteEndpoint.

Returns:
the timeout time in millsenconds.

setAsyncSendTimeout

void setAsyncSendTimeout(long timeoutmillis)
Sets the number of milliseconds the implementation will timeout attempting to send a websocket message for all RemoteEndpoints associated with this container. A non-positive number indicates the implementation will not timeout attempting to send a websocket message asynchronously. Note this default may be overridden in each RemoteEndpoint.


connectToServer

Session connectToServer(Class<?> annotatedEndpointClass,
                        URI path)
                        throws DeploymentException
Connect the supplied annotated object to its server. The supplied object must be a class decorated with the class level javax.websocket.server.WebSocketEndpoint annotation. This method blocks until the connection is established, or throws an error if either the connection could not be made or there was a problem with the supplied endpoint class.

Parameters:
annotatedEndpointClass - the annotated websocket client endpoint with WebSocketClient annotation.
path - the complete path to the server endpoint.
Returns:
the Session created if the connection is successful.
Throws:
DeploymentException - if there was a problem that prevented the client endpoint being connected to its server.

connectToServer

Session connectToServer(Class<? extends Endpoint> endpointClass,
                        ClientEndpointConfiguration cec,
                        URI path)
                        throws DeploymentException
Connect the supplied programmatic endpoint to its server with the given configuration. This method blocks until the connection is established, or throws an error if the connection could not be made.

Parameters:
endpointClass - the programmatic client endpoint class Endpoint.
path - the complete path to the server endpoint.
cec - the configuration used to configure the programmatic endpoint.
Returns:
the Session created if the connection is successful.
Throws:
DeploymentException - if there was a problem that prevented the client endpoint being connected to its server.

getMaxSessionIdleTimeout

long getMaxSessionIdleTimeout()
Return the maximum time in milliseconds that a web socket session may be idle before the container may close it.

Returns:
the number of milliseconds idle web socket sessions are active

setMaxSessionIdleTimeout

void setMaxSessionIdleTimeout(long timeout)
Sets the maximum time that a web socket session may be idle before the container may close it.

Parameters:
timeout - the maximum time in milliseconds.

getDefaultMaxBinaryMessageBufferSize

int getDefaultMaxBinaryMessageBufferSize()
Returns the default maximum size of incoming binary message that this container will buffer. This default may be overridden on a per session basis using Session.setMaxBinaryMessageBufferSize(int)

Returns:
the maximum size of incoming binary message in number of bytes.

setDefaultMaxBinaryMessageBufferSize

void setDefaultMaxBinaryMessageBufferSize(int max)
Sets the default maximum size of incoming binary message that this container will buffer.

Parameters:
max - the maximum size of binary message in number of bytes.

getDefaultMaxTextMessageBufferSize

int getDefaultMaxTextMessageBufferSize()
Returns the default maximum size of incoming text message that this container will buffer. This default may be overridden on a per session basis using Session.setMaxTextMessageBufferSize(int)

Returns:
the maximum size of incoming text message in number of bytes.

setDefaultMaxTextMessageBufferSize

void setDefaultMaxTextMessageBufferSize(int max)
Sets the maximum size of incoming text message that this container will buffer.

Parameters:
max - the maximum size of text message in number of bytes.

getInstalledExtensions

Set<Extension> getInstalledExtensions()
Return the set of Extensions installed in the container.

Returns:
the set of extensions.



Copyright © 2012-2013 Oracle and/or its affiliates. All rights reserved.