public class DebugRequestInterceptor extends 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;
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
proceed |
protected Object |
response |
| Constructor and Description |
|---|
DebugRequestInterceptor() |
DebugRequestInterceptor(boolean proceed) |
DebugRequestInterceptor(Object response) |
| Modifier and Type | Method and Description |
|---|---|
<T extends ConnectorRequest<?>> |
getRequest() |
<T> T |
getResponse() |
<T> T |
getTarget() |
Object |
handleInvocation(ConnectorInvocation invocation)
Intercept and handle the actual invocation.
|
boolean |
isProceed() |
void |
setProceed(boolean proceed) |
void |
setResponse(Object response) |
protected Object response
protected boolean proceed
public DebugRequestInterceptor()
public DebugRequestInterceptor(boolean proceed)
public DebugRequestInterceptor(Object response)
public Object handleInvocation(ConnectorInvocation invocation) throws Exception
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();
}
handleInvocation in interface ConnectorRequestInterceptorinvocation - the invocationExceptionpublic void setProceed(boolean proceed)
public boolean isProceed()
public void setResponse(Object response)
public <T> T getResponse()
public <T extends ConnectorRequest<?>> T getRequest()
public <T> T getTarget()
Copyright © 2014–2021 Camunda Services GmbH. All rights reserved.