Class ValidateCopyHeaders
java.lang.Object
org.chenile.core.interceptors.BaseChenileInterceptor
org.chenile.core.interceptors.ValidateCopyHeaders
- All Implemented Interfaces:
Command<ChenileExchange>
As per HTTP convention, all custom headers start with "x-"
This interceptor copies all headers that start with "x-" into the context.
The context can then be used to read the values by subsequent interceptors and other classes.
If headers start with x-p- then they are considered protected. This means that
they cannot be passed from the outside by the requester. Attempts to pass
them will result in a security exception. This is because we consider such
requests as attempts to hack the system. These internal headers will need to be pushed into the
system by subsequent interceptors.
Please see chenile headers for more details.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoPreProcessing(ChenileExchange exchange) Override this to do pre-processing.voidexecute(ChenileExchange exchange) Restores the caller's context afterwards instead of clearing it.Methods inherited from class BaseChenileInterceptor
bypassInterception, doContinue, doPostProcessing, getExtensionByAnnotation, getExtensionByAnnotation, resumeFromSavedPoint, savePoint
-
Field Details
-
contextContainer
-
-
Constructor Details
-
ValidateCopyHeaders
public ValidateCopyHeaders()
-
-
Method Details
-
doPreProcessing
Description copied from class:BaseChenileInterceptorOverride this to do pre-processing. This will be called before the service is invoked. Don't expect to see exception or response being set inChenileExchange. However you can check forChenileExchange.getBody()to manipulate the body if this interceptor is a Chenile post processor or a service specific or operation specific interceptor.
If this interceptor is a Chenile pre-processor, thenChenileExchange.getBody()will return null. Then you need to look at headers only.- Overrides:
doPreProcessingin classBaseChenileInterceptor- Parameters:
exchange-
-
execute
Restores the caller's context afterwards instead of clearing it. A Chenile call made from inside other work (an event raised by the outbox dispatcher, a local proxy call) must not wipe the caller's tenant: a connection opened after the call would otherwise go to the wrong database. For a request thread the saved context is empty, so this is the same as clearing it.- Specified by:
executein interfaceCommand<ChenileExchange>- Overrides:
executein classBaseChenileInterceptor- Throws:
Exception
-
CHENILE