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 bothFilterandHandlerinstances. 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 response
The capture decorator can be configured to globally enable entity capture using the captureEntity boolean attribute (default to{ "name": "capture", "type": "CaptureDecorator", "config": { "captureEntity": false, "captureContext": false } }false). To capture the context at the capture point as well, use the captureContext boolean attribute (default tofalse).To decorate a component, just add the decorator declaration next to the
configelement:Notice that the attribute name in the decorated object has to be the same as the decorator heap object name ({ "type": "...", "capture": [ "FILTERED_REQUEST", "RESPONSE" ], "config": { ... } }capturein our example). A default capture decorator is automatically created when OpenIG 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 classCaptureDecorator.HeapletCreates and initializes a CaptureDecorator in a heap environment.
-
Constructor Summary
Constructors Constructor Description CaptureDecorator(String name, boolean captureEntity, boolean captureContext)Builds a newcapturedecorator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.forgerock.http.FilterdecorateFilter(org.forgerock.http.Filter delegate, org.forgerock.json.JsonValue decoratorConfig, Context context)Decorates the provideddelegateFilterinstance with the provideddecoratorConfigconfiguration.protected org.forgerock.http.HandlerdecorateHandler(org.forgerock.http.Handler delegate, org.forgerock.json.JsonValue decoratorConfig, Context context)Decorates the provideddelegateHandlerinstance with the provideddecoratorConfigconfiguration.-
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 newcapturedecorator.- Parameters:
name- The name of this decoratorcaptureEntity-trueif the decorator needs to capture the entity,falseotherwisecaptureContext-trueif the decorator needs to capture the context,falseotherwise
-
-
Method Detail
-
decorateFilter
protected org.forgerock.http.Filter decorateFilter(org.forgerock.http.Filter delegate, org.forgerock.json.JsonValue decoratorConfig, Context context) throws HeapExceptionDescription copied from class:AbstractHandlerAndFilterDecoratorDecorates the provideddelegateFilterinstance with the provideddecoratorConfigconfiguration.- Specified by:
decorateFilterin classAbstractHandlerAndFilterDecorator- Parameters:
delegate- Filter instance to be decorateddecoratorConfig- the decorator configuration to applycontext- contextual information of the decorated instance- Returns:
- a decorated filter instance (or original filter delegate)
- Throws:
HeapException- when decoration fails
-
decorateHandler
protected org.forgerock.http.Handler decorateHandler(org.forgerock.http.Handler delegate, org.forgerock.json.JsonValue decoratorConfig, Context context) throws HeapExceptionDescription copied from class:AbstractHandlerAndFilterDecoratorDecorates the provideddelegateHandlerinstance with the provideddecoratorConfigconfiguration.- Specified by:
decorateHandlerin classAbstractHandlerAndFilterDecorator- Parameters:
delegate- Handler instance to be decorateddecoratorConfig- the decorator configuration to applycontext- contextual information of the decorated instance- Returns:
- a decorated handler instance (or original handler delegate)
- Throws:
HeapException- when decoration fails
-
-