Class DebugRequestInterceptor
- java.lang.Object
-
- org.camunda.connect.impl.DebugRequestInterceptor
-
- All Implemented Interfaces:
ConnectorRequestInterceptor
public class DebugRequestInterceptor extends java.lang.Object implements ConnectorRequestInterceptor
A dummy debug connector, which saves the
ConnectorRequest(getRequest()) and the raw request (getTarget()) for debugging purpose.The boolean constructor flag determines whether the request invocation should be continued or aborted after this interceptor. Also it is possible to add a response object which will returned without further passing the interceptor chain;
- Author:
- Sebastian Menski
-
-
Constructor Summary
Constructors Constructor Description DebugRequestInterceptor()DebugRequestInterceptor(boolean proceed)DebugRequestInterceptor(java.lang.Object response)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends ConnectorRequest<?>>
TgetRequest()<T> TgetResponse()<T> TgetTarget()java.lang.ObjecthandleInvocation(ConnectorInvocation invocation)Intercept and handle the actual invocation.booleanisProceed()voidsetProceed(boolean proceed)voidsetResponse(java.lang.Object response)
-
-
-
Method Detail
-
handleInvocation
public java.lang.Object handleInvocation(ConnectorInvocation invocation) throws java.lang.Exception
Description copied from interface:ConnectorRequestInterceptorIntercept and handle the actual invocation. An implementation of this method *must* call
invocation.proceed();and return the result:public Object handleInvocation(ConnectorInvocation invocation) throws Exception { // do something before the request try { Object result = invocation.proceed(); // do something after a successful request return result; } catch(Exception e) { // do something after a failed request throw e; } }This may be useful for "management" use cases such as logging, failure tracking etc... and modifying the Thread context of the request thread (Security Context, Transactions, ...).
It is also possible for an implementation to access and modify the low level "raw" request object before it is executed by the connector:
public Object handleInvocation(ConnectorInvocation invocation) throws Exception { Object rawRequest = invocation.getTarget(); // cast rawRequest to the low-level connector implementation object and work with it. // finally return invocation.proceed(); }- Specified by:
handleInvocationin interfaceConnectorRequestInterceptor- Parameters:
invocation- the invocation- Returns:
- the result of the invocation
- Throws:
java.lang.Exception
-
setProceed
public void setProceed(boolean proceed)
-
isProceed
public boolean isProceed()
-
setResponse
public void setResponse(java.lang.Object response)
-
getResponse
public <T> T getResponse()
-
getRequest
public <T extends ConnectorRequest<?>> T getRequest()
-
getTarget
public <T> T getTarget()
-
-