public class RequestHandlerComposite extends java.lang.Object implements RequestHandler
RequestHandler
.
The result of the process from a RequestHandlerComposite
is the result of the first RequestHandler
matching the HTTPRequest
in the array. The handlers are browsed in the order they have been added.
Constructor and Description |
---|
RequestHandlerComposite()
Constructs a
RequestHandlerComposite with an empty list. |
Modifier and Type | Method and Description |
---|---|
void |
addRequestHandler(RequestHandler handler)
Adds a
RequestHandler in the list. |
HTTPResponse |
process(HTTPRequest request,
java.util.Map<java.lang.String,java.lang.String> attributes)
Processes the request and creates the appropriate response, or null if this request handler doesn't match the
request.
|
public RequestHandlerComposite()
RequestHandlerComposite
with an empty list.public HTTPResponse process(HTTPRequest request, java.util.Map<java.lang.String,java.lang.String> attributes)
RequestHandler
process
in interface RequestHandler
request
- the HTTPRequest
to process.attributes
- the attributes of the request.HTTPResponse
to send, or null if not handled by this RequestHandler
.public final void addRequestHandler(RequestHandler handler)
RequestHandler
in the list.
The handlers are browsed in the order they have been added.
handler
- the RequestHandler
to add.