Class RequestDispatcher
java.lang.Object
org.simpleframework.http.core.RequestDispatcher
- All Implemented Interfaces:
Runnable
The
RequestDispatcher object is used to dispatch a
request and response to the container. This is the root task that
executes all transactions. A transaction is dispatched to the
container which can deal with it asynchronously, however as a
safeguard the dispatcher will catch any exceptions thrown and close
the connection if required. Closing the connection if an exception
is thrown ensures that CLOSE_WAIT issues do not arise with open
connections that can not be closed within the container.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ChannelThis is the channel associated with the request to dispatch.private final ContainerThis is the container that is used to handle the transactions.private final ResponseObserverThis is the observer object used to signal completion events.private final RequestThis is the request object which contains the request entity.private final ResponseThis is the response object used to response to the request.private final TraceThis is the trace that is used to track the request dispatch. -
Constructor Summary
ConstructorsConstructorDescriptionRequestDispatcher(Container container, Controller controller, Entity entity) Constructor for theRequestDispatcherobject. -
Method Summary
-
Field Details
-
observer
This is the observer object used to signal completion events. -
container
This is the container that is used to handle the transactions. -
response
This is the response object used to response to the request. -
request
This is the request object which contains the request entity. -
channel
This is the channel associated with the request to dispatch. -
trace
This is the trace that is used to track the request dispatch.
-
-
Constructor Details
-
RequestDispatcher
Constructor for theRequestDispatcherobject. This creates a request and response object using the provided entity, these can then be passed to the container to handle it.- Parameters:
container- this is the container to handle the requestcontroller- the controller used to handle the next requestentity- this contains the current request entity
-
-
Method Details
-
run
-
dispatch
Thisdispatchmethod will dispatch the request and response objects to the container. This will interpret the target and semantics from the request object and compose a response for the request which is sent to the connected client. If there is an exception this will close the socket channel.- Throws:
Exception
-