Interface Router

All Known Implementing Classes:
DirectRouter, PathRouter, ProtocolRouter

public interface Router
The Router interface represents a means of routing a session initiating request to the correct service. Typically a service is chosen based on the sub-protocol provided in the initiating request, however it can be chosen on any criteria available in the request. An initiating request must contain a Connection header with the websocket token according to RFC 6455 section 4.2.1. If the request does not contain this token it is treated as a normal request and a Service will not be resolved.

If a service has been successfully chosen from the initiating request the the value of Sec-WebSocket-Protocol will contain either the chosen protocol if a match was made with the initiating request or null to indicate a default choice.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    route(Request request, Response response)
    This is used to route an incoming request to a service if the request represents a WebSocket handshake as defined by RFC 6455.
  • Method Details

    • route

      Service route(Request request, Response response)
      This is used to route an incoming request to a service if the request represents a WebSocket handshake as defined by RFC 6455. If the request is not a session initiating handshake then this must return a null value to allow it to be processed by some other part of the server.
      Parameters:
      request - this is the request to use for routing
      response - this is the response to establish the session
      Returns:
      a service that can be used to process the session