public class Chain extends GenericHandler
When a chain dispatches an exchange to a filter, it creates a "subchain" (a subset of this chain, which contains the remaining downstream filters and handler), and passes it as a parameter to the filter. For this reason, a filter should make no assumptions or correlations using the chain it is supplied with when invoked.
A filter may elect to terminate dispatching of the exchange to the rest of the chain by not
calling chain.handle(exchange)
and generate its own response or dispatch to a
completely different handler.
Filter
Modifier and Type | Class and Description |
---|---|
static class |
Chain.Heaplet
Creates and initializes a filter chain in a heap environment.
|
logger, storage
Constructor and Description |
---|
Chain(Handler handler)
Builds a chain of filters that will finally dispatch to the given handler.
|
Modifier and Type | Method and Description |
---|---|
List<Filter> |
getFilters()
Returns the list of filters, in the order they are to be dispatched by the chain.
|
void |
handle(Exchange exchange)
Called to request the handler respond to the request.
|
public List<Filter> getFilters()
public void handle(Exchange exchange) throws HandlerException, IOException
Handler
A handler that doesn't hand-off an exchange to another handler downstream is responsible for creating the response in the exchange object.
Important note: If an existing response exists in the exchange object
and the handler intends to replace it with its own, it must first check to see if the
existing response has an entity, and if it does, must call its close
method in
order to signal that the processing of the response from a remote server is complete.
exchange
- the exchange containing the request to handle.HandlerException
- if an exception occurs that prevents handling of the request.IOException
- if an I/O exception occurs.Copyright © 2014 ForgeRock AS. All rights reserved.