Class CaptureDecorator
- java.lang.Object
-
- org.forgerock.openig.decoration.helper.AbstractDecorator
-
- org.forgerock.openig.decoration.helper.AbstractHandlerAndFilterDecorator
-
- org.forgerock.openig.decoration.capture.CaptureDecorator
-
- All Implemented Interfaces:
Decorator
public class CaptureDecorator extends AbstractHandlerAndFilterDecorator
The capture decorator can decorates bothFilter
andHandler
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 } }
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 tofalse
). To mask values from headers and/or values from the attributes context, use the optional masks section to match by header and/or attribute name and mask the actual value. The name to match can be a regular expression. To override the default mask value of *****, provide the optional mask to set a different mask value.{ "name": "capture", "type": "CaptureDecorator", "config": { "masks": { "headers": [ "x-token" ], "attributes": [ "replay" ], "mask": "*** my mask value ***" } } }
To decorate a component, just add the decorator declaration next to the
config
element:{ "type": "...", "capture": [ "FILTERED_REQUEST", "RESPONSE" ], "config": { ... } }
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CaptureDecorator.Heaplet
Creates and initializes a CaptureDecorator in a heap environment.
-
Constructor Summary
Constructors Constructor Description CaptureDecorator(String name, boolean captureEntity, boolean captureContext)
Builds a newcapture
decorator.CaptureDecorator(String name, boolean captureEntity, boolean captureContext, int maxEntityLength, KeyValueProcessor headerProcessor, KeyValueProcessor attributeProcessor, KeyValueProcessor trailerProcessor)
Builds a newcapture
decorator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DecorationHandle
decorateFilter(Filter delegate, JsonValue decoratorConfig, Context context)
protected DecorationHandle
decorateHandler(Handler delegate, JsonValue decoratorConfig, Context context)
-
Methods inherited from class org.forgerock.openig.decoration.helper.AbstractHandlerAndFilterDecorator
accepts, decorate
-
Methods inherited from class org.forgerock.openig.decoration.helper.AbstractDecorator
getLogger
-
-
-
-
Constructor Detail
-
CaptureDecorator
public CaptureDecorator(String name, boolean captureEntity, boolean captureContext)
Builds a newcapture
decorator.- Parameters:
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
otherwise
-
CaptureDecorator
public CaptureDecorator(String name, boolean captureEntity, boolean captureContext, int maxEntityLength, KeyValueProcessor headerProcessor, KeyValueProcessor attributeProcessor, KeyValueProcessor trailerProcessor)
Builds a newcapture
decorator.- Parameters:
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 ifcaptureEntity
is enabled.headerProcessor
- TheKeyValueProcessor
to apply to header values.attributeProcessor
- TheKeyValueProcessor
to apply to attribute values.trailerProcessor
- TheKeyValueProcessor
to apply to trailer values.
-
-
Method Detail
-
decorateFilter
protected DecorationHandle decorateFilter(Filter delegate, JsonValue decoratorConfig, Context context) throws HeapException
Description copied from class:AbstractHandlerAndFilterDecorator
- Specified by:
decorateFilter
in classAbstractHandlerAndFilterDecorator
- Parameters:
delegate
- Filter instance to be decorateddecoratorConfig
- the decorator configuration to applycontext
- contextual information of the decorated instance- Returns:
- a handle to the decoration
- Throws:
HeapException
- when decoration fails
-
decorateHandler
protected DecorationHandle decorateHandler(Handler delegate, JsonValue decoratorConfig, Context context) throws HeapException
Description copied from class:AbstractHandlerAndFilterDecorator
- Specified by:
decorateHandler
in classAbstractHandlerAndFilterDecorator
- Parameters:
delegate
- Handler instance to be decorateddecoratorConfig
- the decorator configuration to applycontext
- contextual information of the decorated instance- Returns:
- a handle to the decoration
- Throws:
HeapException
- when decoration fails
-
-