Class RouterContainer
- java.lang.Object
-
- org.simpleframework.http.socket.service.RouterContainer
-
- All Implemented Interfaces:
Container
public class RouterContainer extends java.lang.Object implements Container
TheRouterContaineris used to route requests that satisfy a WebSocket opening handshake to a specific service. Each request intercepted by thisContainerimplementation is examined for opening handshake criteria as specified by RFC 6455, and if it contains the required information it is router to a specific service using aRouterimplementation. If the request does not contain the required criteria it is handled by an internal container delegate.- Author:
- Niall Gallagher
- See Also:
Router
-
-
Constructor Summary
Constructors Constructor Description RouterContainer(Container container, Router router, int threads)Constructor for theRouterContainerobject.RouterContainer(Container container, Router router, int threads, long ping)Constructor for theRouterContainerobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandle(Request req, Response resp)This method is used to create a dispatch aSessionto a specific service selected by a router.
-
-
-
Constructor Detail
-
RouterContainer
public RouterContainer(Container container, Router router, int threads) throws java.io.IOException
Constructor for theRouterContainerobject. This requires a container to delegate traditional requests to and aRouterimplementation which can be used to select a service to dispatch a WebSocket session to.- Parameters:
container- this is the container to delegate torouter- this is the router used to select servicesthreads- this contains the number of threads to use- Throws:
java.io.IOException
-
RouterContainer
public RouterContainer(Container container, Router router, int threads, long ping) throws java.io.IOException
Constructor for theRouterContainerobject. This requires a container to delegate traditional requests to and aRouterimplementation which can be used to select a service to dispatch a WebSocket session to.- Parameters:
container- this is the container to delegate torouter- this is the router used to select servicesthreads- this contains the number of threads to useping- this is the frequency to send ping frames with- Throws:
java.io.IOException
-
-
Method Detail
-
handle
public void handle(Request req, Response resp)
This method is used to create a dispatch aSessionto a specific service selected by a router. If the session initiating handshake fails for any reason this will close the underlying TCP connection and send a HTTP 400 response back to the client. All traditional requests that do not represent an WebSocket opening handshake are dispatched to the internal container.
-
-