Name

DispatchHandler — dispatch to one of a list of handlers

Description

Dispatches to one of a list of handlers. When an exchange is handled, each handler's condition is evaluated. If a condition expression yields true, then the exchange is dispatched to the associated handler with no further processing.

Usage

{
     "name": string,
     "type": "DispatchHandler",
     "config": {
         "bindings": [
             {
                 "condition": expression,
                 "handler": string,
                 "baseURI": string,
             }, ...
         ]
     }
}

Properties

"bindings": array of objects, required

A list of bindings of conditions and associated handlers to dispatch to.

"condition": expression, optional

Condition to evaluate to determine if associated handler should be dispatched to. If omitted, then dispatch is unconditional.

"handler": string, required

The name of the handler heap object to dispatch to if the associated condition yields true.

"baseURI": string, optional

Overrides the existing request URI, making requests relative to a new base URI. Only scheme, host and port are used in the supplied URI. Default: leave URI untouched.

Example

{
     "name": "Dispatcher",
     "type": "DispatchHandler",
     "config": {
         "bindings": [ 
             {
                 "condition": "${exchange.request.uri.path == '/login.php'}",
                 "handler": "LoginChain",
             },
             {
                 "condition": "${exchange.request.uri.path == '/logout.php'}",
                 "handler": "LogoutChain",
             },
             {
                 "handler": "ClientHandler",
             }
         ]   
     }   
}

Javadoc

org.forgerock.openig.handler.DispatchHandler