public class StaticResponseHandler extends GenericHandler
Modifier and Type | Class and Description |
---|---|
static class |
StaticResponseHandler.Heaplet
Creates and initializes a static response handler in a heap environment.
|
logger, storage
Constructor and Description |
---|
StaticResponseHandler(Integer status,
String reason)
Constructor.
|
StaticResponseHandler(Integer status,
String reason,
String version,
Expression entity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
StaticResponseHandler |
addHeader(String key,
Expression expression)
Adds a pair key / expression to the header.
|
void |
handle(Exchange exchange)
Called to request the handler respond to the request.
|
public StaticResponseHandler(Integer status, String reason)
status
- The response status to set.reason
- The response status reason to set.public StaticResponseHandler(Integer status, String reason, String version, Expression entity)
status
- The response status to set.reason
- The response status reason to set.version
- The protocol version.entity
- The message entity expression.public StaticResponseHandler addHeader(String key, Expression expression)
key
- The header key.expression
- The expression to evaluate.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.