org.glassfish.tyrus.server
Class DefaultServerEndpointConfiguration

java.lang.Object
  extended by org.glassfish.tyrus.DefaultEndpointConfiguration
      extended by org.glassfish.tyrus.server.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, uri
 
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.
 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.
 boolean matchesURI(URI uri)
          Answers whether the current configuration matches the given URI.
 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, getPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.net.websocket.EndpointConfiguration
getDecoders, getEncoders, getPath
 

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. See Negotiating Extensions

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

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:

matchesURI

public boolean matchesURI(URI uri)
Description copied from interface: ServerEndpointConfiguration
Answers whether the current configuration matches the given URI. 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:

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


Copyright © 2012. All Rights Reserved.