org.glassfish.tyrus
Class DefaultServerEndpointConfiguration

java.lang.Object
  extended by org.glassfish.tyrus.DefaultEndpointConfiguration
      extended by org.glassfish.tyrus.DefaultServerEndpointConfiguration
All Implemented Interfaces:
EndpointConfiguration, ServerEndpointConfiguration

public class DefaultServerEndpointConfiguration
extends DefaultEndpointConfiguration
implements ServerEndpointConfiguration

Provides the default ServerEndpointConfiguration.

Author:
Stepan Kopriva (stepan.kopriva at oracle.com)

Nested Class Summary
static class DefaultServerEndpointConfiguration.Builder
          Builder class used to build the DefaultServerEndpointConfiguration.
 
Field Summary
 
Fields inherited from class org.glassfish.tyrus.DefaultEndpointConfiguration
extensions, subProtocols
 
Constructor Summary
protected DefaultServerEndpointConfiguration(String uri, List<Encoder> encoders, List<Decoder> decoders, List<String> subprotocols, List<String> extensions, List<String> origins)
          Creates new configuration for Endpoint which is used on the server side.
 
Method Summary
 boolean checkOrigin(String originHeaderValue)
          Check the value of the Origin header (See definition) the client passed during the opening handshake.
 List<String> getNegotiatedExtensions(List<String> requestedExtensions)
          http://java.net/jira/browse/WEBSOCKET_SPEC-45 Return the ordered list of extensions that this server will support given the requested extension list passed in, the empty list if none.
 String getNegotiatedSubprotocol(List<String> requestedSubprotocols)
          Return the subprotocol this server endpoint has chosen from the requested list supplied by a client who wishes to connect, or none if there wasn't one this server endpoint liked.
 String getPath()
          Return the path for this endpoint configuration.
 boolean matchesURI(URI uri)
          Answers whether the current configuration matches the given path.
 void modifyHandshake(HandshakeRequest request, HandshakeResponse response)
          Called by the container after it has formulated a handshake response resulting from a well-formed handshake request.
 
Methods inherited from class org.glassfish.tyrus.DefaultEndpointConfiguration
getDecoders, getEncoders
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.websocket.EndpointConfiguration
getDecoders, getEncoders
 

Constructor Detail

DefaultServerEndpointConfiguration

protected DefaultServerEndpointConfiguration(String uri,
                                             List<Encoder> encoders,
                                             List<Decoder> decoders,
                                             List<String> subprotocols,
                                             List<String> extensions,
                                             List<String> origins)
Creates new configuration for Endpoint which is used on the server side.

Parameters:
encoders - message encoders.
decoders - message decoders.
subprotocols - supported sub - protocols.
extensions - supported extensions.
origins - accepted origins.
Method Detail

getNegotiatedSubprotocol

public String getNegotiatedSubprotocol(List<String> requestedSubprotocols)
Description copied from interface: ServerEndpointConfiguration
Return the subprotocol this server endpoint has chosen from the requested list supplied by a client who wishes to connect, or none if there wasn't one this server endpoint liked. See Sending the Server's Opening Handshake

Specified by:
getNegotiatedSubprotocol in interface ServerEndpointConfiguration
Parameters:
requestedSubprotocols - the requested subprotocols.
Returns:
the negotiated subprotocol.

getNegotiatedExtensions

public List<String> getNegotiatedExtensions(List<String> requestedExtensions)
Description copied from interface: ServerEndpointConfiguration
http://java.net/jira/browse/WEBSOCKET_SPEC-45 Return the ordered list of extensions that this server will support given the requested extension list passed in, the empty list if none. See Negotiating Extensions

Specified by:
getNegotiatedExtensions in interface ServerEndpointConfiguration
Parameters:
requestedExtensions - the requested extentions, in order.
Returns:
the list of extensions negotiated

checkOrigin

public boolean checkOrigin(String originHeaderValue)
Description copied from interface: ServerEndpointConfiguration
Check the value of the Origin header (See definition) the client passed during the opening handshake.

Specified by:
checkOrigin in interface ServerEndpointConfiguration
Parameters:
originHeaderValue - the value of the origin header.
Returns:
whether the check passed or not

matchesURI

public boolean matchesURI(URI uri)
Description copied from interface: ServerEndpointConfiguration
Answers whether the current configuration matches the given path. This method may be overridden by implementations with any number of algorithms for determining a match.

Specified by:
matchesURI in interface ServerEndpointConfiguration
Parameters:
uri - the uri of the incoming handshake.
Returns:
whether there was a match

modifyHandshake

public void modifyHandshake(HandshakeRequest request,
                            HandshakeResponse response)
Description copied from interface: ServerEndpointConfiguration
Called by the container after it has formulated a handshake response resulting from a well-formed handshake request. The container has already has already checked that this configuration has a matching URI, determined the validity of the origin using the checkOrigin method, and filled out the negotiated subprotocols and extensions based on this configuration. Custom configurations may override this method in order to inspect the request parameters and modify the handshake response. and the URI checking also.

Specified by:
modifyHandshake in interface ServerEndpointConfiguration
Parameters:
request - the opening handshake request.
response - the proposed opening handshake response

getPath

public String getPath()
Description copied from interface: ServerEndpointConfiguration
Return the path for this endpoint configuration. The path is the URI or URI-template relative to the websocket root of the server to which the endpoint using this configuration will be mapped. The path always begins with a leading "/". A trailing "/" will be ignored.

Specified by:
getPath in interface ServerEndpointConfiguration
Returns:
the relative path for this configuration.


Copyright © 2012. All Rights Reserved.