Interface ExecutionContext
-
- All Known Subinterfaces:
MessageExecutionContext,RequestExecutionContext
public interface ExecutionContext
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_ADAPTED_CONTEXTAdapted ExecutionContext for V3 compatibility.static StringATTR_APIstatic StringATTR_API_DEPLOYED_ATstatic StringATTR_APPLICATIONstatic StringATTR_CONTEXT_PATHstatic StringATTR_ENVIRONMENTstatic StringATTR_INTERNAL_EXECUTION_FAILUREstatic StringATTR_INTERNAL_PREFIXstatic StringATTR_INVOKERstatic StringATTR_ORGANIZATIONstatic StringATTR_PLANstatic StringATTR_PREFIXstatic StringATTR_QUOTA_COUNTstatic StringATTR_QUOTA_LIMITstatic StringATTR_QUOTA_REMAININGstatic StringATTR_QUOTA_RESET_TIMEstatic StringATTR_REQUEST_ENDPOINTstatic StringATTR_REQUEST_METHODstatic StringATTR_RESOLVED_PATHstatic StringATTR_SUBSCRIPTION_IDstatic StringATTR_USERstatic StringATTR_USER_ROLES
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TgetAttribute(String name)Returns the value of the attribute cast in the expected type T, ornullif no attribute for the given name exists.Set<String>getAttributeNames()Returns an Enumeration containing the names of the attributes available to this request.<T> Map<String,T>getAttributes()Get all attributes available.<T> TgetComponent(Class<T> componentClass)<T> TgetInternalAttribute(String name)Returns the value of the internal attribute cast in the expected type T, ornullif no attribute for the given name exists.<T> Map<String,T>getInternalAttributes()Get all internal attributes available.io.gravitee.el.TemplateEnginegetTemplateEngine()Get theTemplateEnginethat can be used to evaluate EL expressions.io.reactivex.Completableinterrupt()Interrupted the current execution while indicating that the response can be sent "as is" to the downstream.io.reactivex.CompletableinterruptWith(ExecutionFailure failure)Same asinterrupt()but with anExecutionFailureobject that indicates that the execution has failed.voidputAttribute(String name, Object value)Stores an attribute in this request.voidputInternalAttribute(String name, Object value)Stores an internal attribute in this request.voidremoveAttribute(String name)Removes an attribute from this request.voidremoveInternalAttribute(String name)Removes an internal attribute from this request.voidsetAttribute(String name, Object value)Same aputAttribute(String, Object).voidsetInternalAttribute(String name, Object value)
-
-
-
Field Detail
-
ATTR_PREFIX
static final String ATTR_PREFIX
- See Also:
- Constant Field Values
-
ATTR_INTERNAL_PREFIX
static final String ATTR_INTERNAL_PREFIX
- See Also:
- Constant Field Values
-
ATTR_INTERNAL_EXECUTION_FAILURE
static final String ATTR_INTERNAL_EXECUTION_FAILURE
- See Also:
- Constant Field Values
-
ATTR_CONTEXT_PATH
static final String ATTR_CONTEXT_PATH
- See Also:
- Constant Field Values
-
ATTR_RESOLVED_PATH
static final String ATTR_RESOLVED_PATH
- See Also:
- Constant Field Values
-
ATTR_APPLICATION
static final String ATTR_APPLICATION
- See Also:
- Constant Field Values
-
ATTR_API
static final String ATTR_API
- See Also:
- Constant Field Values
-
ATTR_API_DEPLOYED_AT
static final String ATTR_API_DEPLOYED_AT
- See Also:
- Constant Field Values
-
ATTR_SUBSCRIPTION_ID
static final String ATTR_SUBSCRIPTION_ID
- See Also:
- Constant Field Values
-
ATTR_PLAN
static final String ATTR_PLAN
- See Also:
- Constant Field Values
-
ATTR_REQUEST_METHOD
static final String ATTR_REQUEST_METHOD
- See Also:
- Constant Field Values
-
ATTR_REQUEST_ENDPOINT
static final String ATTR_REQUEST_ENDPOINT
- See Also:
- Constant Field Values
-
ATTR_INVOKER
static final String ATTR_INVOKER
- See Also:
- Constant Field Values
-
ATTR_QUOTA_COUNT
static final String ATTR_QUOTA_COUNT
- See Also:
- Constant Field Values
-
ATTR_QUOTA_REMAINING
static final String ATTR_QUOTA_REMAINING
- See Also:
- Constant Field Values
-
ATTR_QUOTA_LIMIT
static final String ATTR_QUOTA_LIMIT
- See Also:
- Constant Field Values
-
ATTR_QUOTA_RESET_TIME
static final String ATTR_QUOTA_RESET_TIME
- See Also:
- Constant Field Values
-
ATTR_USER
static final String ATTR_USER
- See Also:
- Constant Field Values
-
ATTR_USER_ROLES
static final String ATTR_USER_ROLES
- See Also:
- Constant Field Values
-
ATTR_ORGANIZATION
static final String ATTR_ORGANIZATION
- See Also:
- Constant Field Values
-
ATTR_ENVIRONMENT
static final String ATTR_ENVIRONMENT
- See Also:
- Constant Field Values
-
ATTR_ADAPTED_CONTEXT
static final String ATTR_ADAPTED_CONTEXT
Adapted ExecutionContext for V3 compatibility.- See Also:
- Constant Field Values
-
-
Method Detail
-
interrupt
io.reactivex.Completable interrupt()
Interrupted the current execution while indicating that the response can be sent "as is" to the downstream. This has direct impact on how the remaining execution flow will behave (ex: remaining policies in a policy chain won't be executed).
-
interruptWith
io.reactivex.Completable interruptWith(ExecutionFailure failure)
Same asinterrupt()but with anExecutionFailureobject that indicates that the execution has failed. TheExecutionFailurecan be processed in order to build a proper response (ex: based on templating, with appropriate accept-encoding, ...).
-
getComponent
<T> T getComponent(Class<T> componentClass)
-
setAttribute
void setAttribute(String name, Object value)
Same aputAttribute(String, Object).- Parameters:
name- a String specifying the name of the attribute.value- the Object to be stored.
-
putAttribute
void putAttribute(String name, Object value)
Stores an attribute in this request. Attributes are reset between requests. Note: prefer use ofputInternalAttribute(String, Object)in case the attribute is not set by the user itself.- Parameters:
name- a String specifying the name of the attribute.value- the Object to be stored.
-
removeAttribute
void removeAttribute(String name)
Removes an attribute from this request. This method is not generally needed as attributes only persist as long as the request is being handled.- Parameters:
name- the name of the attribute to remove.
-
getAttribute
<T> T getAttribute(String name)
Returns the value of the attribute cast in the expected type T, ornullif no attribute for the given name exists.- Type Parameters:
T- the expected type of the attribute value. SpecifyObjectif you expect value of any type.- Parameters:
name- the name of the attribute.- Returns:
- an Object containing the value of the attribute, or null if the attribute does not exist.
-
getAttributeNames
Set<String> getAttributeNames()
Returns an Enumeration containing the names of the attributes available to this request. This method returns an empty Enumeration if the request has no attributes available to it.- Returns:
- a set of strings containing the names of the request's attributes.
-
getAttributes
<T> Map<String,T> getAttributes()
Get all attributes available.- Type Parameters:
T- the expected type of the attribute values. SpecifyObjectif you expect values of any types.- Returns:
- the list of all the attributes.
-
setInternalAttribute
void setInternalAttribute(String name, Object value)
- Parameters:
name- the name of the attribute.value- the Object to be stored.
-
putInternalAttribute
void putInternalAttribute(String name, Object value)
Stores an internal attribute in this request. Attributes are reset between requests. Internal attributes can be used to avoid mixin with attribute set by the user during the request processing.- Parameters:
name- the name of the attribute.value- the Object to be stored.
-
removeInternalAttribute
void removeInternalAttribute(String name)
Removes an internal attribute from this request.- Parameters:
name- the name of the internal attribute to remove.
-
getInternalAttribute
<T> T getInternalAttribute(String name)
Returns the value of the internal attribute cast in the expected type T, ornullif no attribute for the given name exists.- Type Parameters:
T- the expected type of the attribute value. SpecifyObjectif you expect value of any type.- Parameters:
name- a String specifying the name of the attribute.- Returns:
- an Object containing the value of the attribute, or null if the attribute does not exist
-
getInternalAttributes
<T> Map<String,T> getInternalAttributes()
Get all internal attributes available. Internal attributes are intended to not be manipulated by end-users. You can safely use internal attribute to temporary store useful objects required during different phases of the execution.- Type Parameters:
T- the expected type of the values. SpecifyObjectif you expect values of any types.- Returns:
- the list of all the internal attributes.
-
getTemplateEngine
io.gravitee.el.TemplateEngine getTemplateEngine()
Get theTemplateEnginethat can be used to evaluate EL expressions.- Returns:
- the El
TemplateEngine.
-
-