| | |
|
|
|
Configuring connection handlers
A connection handler is a small piece of logic that can be configured for a destination. The connection infrastructure invokes a configured connection handler before sending a request and again when receiving the response.
Connection handlers can examine the contents of the request and response and carry out simple processing. Examples of scenarios where a connection handler may be useful include:
- Logging requests sent to a destination and the responses received.
- Manipulating the request or response headers.
- Performing simple transformations of the request or response body.
- Dynamically adding protocol configuration (when it cannot be statically determined by a
connection configuration).
For more information about destination configuration and an overview of destination processing, see Configuring destinations.
For a description of how to write a connection handler, see Creating a connection handler.
Configuring connection handlers for a destination
Connection handlers can be configured for a destination by specifying a handlers list. Each element in the handlers list must contain a class attribute naming the connection handler implementation class. The element may also contain a config attribute in order to supply any configuration parameter required by the connection handler.
For example, the following configuration registers a single connection handler with the named destination and specifies a configuration parameter, "source", for the connection handler.
/config/connection/destinations += [{
"name" : "http://www.projectzero.org/*",
"handlers" : [{
"class" : "zero.core.connection.handlers.logger.SimpleJavaLoggerHandler",
"config" : {
"source" : "mySourceName"
}
}]
}]
|
|
r20 - 30 Jan 2008 - 14:57:21 - rushall
|
|
|
| | |