org.glassfish.tyrus.server
Class TyrusServerContainer

java.lang.Object
  extended by org.glassfish.tyrus.WithProperties
      extended by org.glassfish.tyrus.server.TyrusServerContainer
All Implemented Interfaces:
ClientContainer, ServerContainer

public class TyrusServerContainer
extends WithProperties
implements ServerContainer

Server Container Implementation.

Author:
Martin Matula (martin.matula at oracle.com)

Constructor Summary
TyrusServerContainer(TyrusServer server, String contextPath, ServerConfiguration configuration)
           
 
Method Summary
 void connectToServer(Object endpoint, URI path)
          Connect the supplied annotated object to its server using the supplied handshake parameters.
 Set<Session> getActiveSessions()
          Return a copy of the Set of the currently active web socket sessions.
 Set<String> getInstalledExtensions()
          Return the set of Extensions installed in the container.
 long getMaxBinaryMessageBufferSize()
          Returns the maximum size of binary message that this container will buffer.
 long getMaxSessionIdleTimeout()
          Return the maximum time in milliseconds that a web socket session may be idle before the container may close it.
 long getMaxTextMessageBufferSize()
          Sets the maximum size of text message that this container will buffer.
 void publishServer(Class<? extends Endpoint> endpointClass)
          Publish the given endpoint with the provided configuration information.
 void setMaxBinaryMessageBufferSize(long max)
          Sets the maximum size of binary 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.
 void setMaxTextMessageBufferSize(long max)
          Sets the maximum size of text message that this container will buffer.
 void start()
           
 void stop()
           
 
Methods inherited from class org.glassfish.tyrus.WithProperties
getProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TyrusServerContainer

public TyrusServerContainer(TyrusServer server,
                            String contextPath,
                            ServerConfiguration configuration)
Method Detail

start

public void start()
           throws IOException
Throws:
IOException

stop

public void stop()

publishServer

public void publishServer(Class<? extends Endpoint> endpointClass)
                   throws DeploymentException
Description copied from interface: ServerContainer
Publish the given endpoint with the provided configuration information.

Specified by:
publishServer in interface ServerContainer
Parameters:
endpointClass - the class of the endpoint to be deployed. to deploy the endpoint.
Throws:
DeploymentException

connectToServer

public void connectToServer(Object endpoint,
                            URI path)
                     throws DeploymentException
Description copied from interface: ClientContainer
Connect the supplied annotated object to its server using the supplied handshake parameters. The supplied object must be a class decorated with the class level WebSocketEndpoint annotation.

Specified by:
connectToServer in interface ClientContainer
Parameters:
endpoint - either subclass of Endpoint or a POJO annotated with WebSocketClient annotation.
path - the complete path to the server endpoint
Throws:
DeploymentException

getActiveSessions

public Set<Session> getActiveSessions()
Description copied from interface: ClientContainer
Return a copy of the Set of the currently active web socket sessions. These sessions may not still be active at any point after the return of this method, for example, Iterating over the set at a later time may yield closed session. Use session.isActive() to check.

Specified by:
getActiveSessions in interface ClientContainer
Returns:
the set of sessions, active at the time of return.

getMaxSessionIdleTimeout

public long getMaxSessionIdleTimeout()
Description copied from interface: ClientContainer
Return the maximum time in milliseconds that a web socket session may be idle before the container may close it.

Specified by:
getMaxSessionIdleTimeout in interface ClientContainer
Returns:
the number of milliseconds idle web socket sessions are active

setMaxSessionIdleTimeout

public void setMaxSessionIdleTimeout(long timeout)
Description copied from interface: ClientContainer
Sets the maximum time that a web socket session may be idle before the container may close it.

Specified by:
setMaxSessionIdleTimeout in interface ClientContainer
Parameters:
timeout - the maximum time in milliseconds.

getMaxBinaryMessageBufferSize

public long getMaxBinaryMessageBufferSize()
Description copied from interface: ClientContainer
Returns the maximum size of binary message that this container will buffer.

Specified by:
getMaxBinaryMessageBufferSize in interface ClientContainer
Returns:
the maximum size of binary message in number of bytes

setMaxBinaryMessageBufferSize

public void setMaxBinaryMessageBufferSize(long max)
Description copied from interface: ClientContainer
Sets the maximum size of binary message that this container will buffer.

Specified by:
setMaxBinaryMessageBufferSize in interface ClientContainer
Parameters:
max - the maximum size of binary message in number of bytes

getMaxTextMessageBufferSize

public long getMaxTextMessageBufferSize()
Description copied from interface: ClientContainer
Sets the maximum size of text message that this container will buffer.

Specified by:
getMaxTextMessageBufferSize in interface ClientContainer
Returns:
the maximum size of text message in number of bytes

setMaxTextMessageBufferSize

public void setMaxTextMessageBufferSize(long max)
Description copied from interface: ClientContainer
Sets the maximum size of text message that this container will buffer.

Specified by:
setMaxTextMessageBufferSize in interface ClientContainer
Parameters:
max - the maximum size of text message in number of bytes

getInstalledExtensions

public Set<String> getInstalledExtensions()
Description copied from interface: ClientContainer
Return the set of Extensions installed in the container.

Specified by:
getInstalledExtensions in interface ClientContainer
Returns:
the set of extensions.


Copyright © 2012. All Rights Reserved.