javax.websocket.server
Interface ServerEndpointConfiguration

All Superinterfaces:
EndpointConfiguration
All Known Implementing Classes:
DefaultServerConfiguration

public interface ServerEndpointConfiguration
extends EndpointConfiguration

The ServerEndpointConfiguration is a special kind of endpoint configuration object that contains web socket configuration information specific only to server endpoints. The parametrized type T is the type of the Endpoint that this configures.

Since:
DRAFT 001
Author:
dannycoward

Method Summary
 boolean checkOrigin(String originHeaderValue)
          Check the value of the Origin header (See Origin Header) the client passed during the opening handshake.
 Class<?> getEndpointClass()
          Returns the Class of the endpoint this configuration is configuring.
 List<Extension> getNegotiatedExtensions(List<Extension> requestedExtensions)
          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 interface javax.websocket.EndpointConfiguration
getDecoders, getEncoders
 

Method Detail

getEndpointClass

Class<?> getEndpointClass()
Returns the Class of the endpoint this configuration is configuring. If the endpoint is an annotated endpoint, the value is the class of the Java class annotated with @WebSocketEndpoint. if the endpoint is a programmatic, the value is the class of the subclass of Endpoint.

Returns:
the class of the endpoint, annotated or programmatic.

getNegotiatedSubprotocol

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. See Sending the Server's Opening Handshake

Parameters:
requestedSubprotocols - the requested subprotocols.
Returns:
the negotiated subprotocol.

getNegotiatedExtensions

List<Extension> getNegotiatedExtensions(List<Extension> requestedExtensions)
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

Parameters:
requestedExtensions - the requested extentions, in order.
Returns:
the list of extensions negotiated

checkOrigin

boolean checkOrigin(String originHeaderValue)
Check the value of the Origin header (See Origin Header) the client passed during the opening handshake.

Parameters:
originHeaderValue - the value of the origin header.
Returns:
whether the check passed or not

matchesURI

boolean matchesURI(URI uri)
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.

Parameters:
uri - the uri of the incoming handshake.
Returns:
whether there was a match

modifyHandshake

void modifyHandshake(HandshakeRequest request,
                     HandshakeResponse response)
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 that the server has formulated. and the URI checking also.

Parameters:
request - the opening handshake request.
response - the proposed opening handshake response

getPath

String getPath()
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.

Returns:
the relative path for this configuration.



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