public class CaptureDecorator extends AbstractHandlerAndFilterDecorator
Filter
and Handler
instances. It enables
the user to see the messages coming in and out of the decorated object.
Multiple input/output can be intercepted:
CapturePoint.ALL
: Prints all of the messagesCapturePoint.FILTERED_REQUEST
: Prints the outgoing request (Filter only)CapturePoint.FILTERED_RESPONSE
: Prints the outgoing responseCapturePoint.REQUEST
: Prints incoming + outgoing requestCapturePoint.RESPONSE
: Prints incoming + outgoing responseCapturePoint.NONE
: Disable capture
{
"name": "capture",
"type": "CaptureDecorator",
"config": {
"captureEntity": false,
"captureContext": false
}
}
The capture decorator can be configured to globally enable entity capture using the captureEntity
boolean attribute (default to false
). To set a limit on the maximum length of entities to capture, use
maxEntityLength and set it to a value in bytes, the default is 512K.
To capture the context at the capture point as well, use the captureContext boolean attribute
(default to false
).
To decorate a component, just add the decorator declaration next to the config
element:
{
"type": "...",
"capture": [ "FILTERED_REQUEST", "RESPONSE" ],
"config": { ... }
}
Notice that the attribute name in the decorated object has to be the same as the decorator
heap object name (capture
in our example).
A default capture decorator is automatically created when IG starts. It can be overridden
in the configuration files if default values are not satisfying.Modifier and Type | Class and Description |
---|---|
static class |
CaptureDecorator.Heaplet
Creates and initializes a CaptureDecorator in a heap environment.
|
Constructor and Description |
---|
CaptureDecorator(String name,
boolean captureEntity,
boolean captureContext)
Builds a new
capture decorator. |
CaptureDecorator(String name,
boolean captureEntity,
boolean captureContext,
int maxEntityLength)
Builds a new
capture decorator. |
Modifier and Type | Method and Description |
---|---|
protected Filter |
decorateFilter(Filter delegate,
JsonValue decoratorConfig,
Context context)
|
protected Handler |
decorateHandler(Handler delegate,
JsonValue decoratorConfig,
Context context)
|
accepts, decorate
getLogger
public CaptureDecorator(String name, boolean captureEntity, boolean captureContext)
capture
decorator.name
- The name of this decoratorcaptureEntity
- true
if the decorator needs to capture the entity,
false
otherwisecaptureContext
- true
if the decorator needs to capture the context,
false
otherwisepublic CaptureDecorator(String name, boolean captureEntity, boolean captureContext, int maxEntityLength)
capture
decorator.name
- The name of this decoratorcaptureEntity
- true
if the decorator needs to capture the entity,
false
otherwisecaptureContext
- true
if the decorator needs to capture the context,
false
otherwisemaxEntityLength
- Set the maximum entity length to capture if captureEntity
is enabled.protected Filter decorateFilter(Filter delegate, JsonValue decoratorConfig, Context context) throws HeapException
AbstractHandlerAndFilterDecorator
decorateFilter
in class AbstractHandlerAndFilterDecorator
delegate
- Filter instance to be decorateddecoratorConfig
- the decorator configuration to applycontext
- contextual information of the decorated instanceHeapException
- when decoration failsprotected Handler decorateHandler(Handler delegate, JsonValue decoratorConfig, Context context) throws HeapException
AbstractHandlerAndFilterDecorator
decorateHandler
in class AbstractHandlerAndFilterDecorator
delegate
- Handler instance to be decorateddecoratorConfig
- the decorator configuration to applycontext
- contextual information of the decorated instanceHeapException
- when decoration failsCopyright 2011-2017 ForgeRock AS.