Interface GenericExecutionContext
-
- All Known Subinterfaces:
ExecutionContext
,HttpExecutionContext
,MessageExecutionContext
public interface GenericExecutionContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
getAttribute(String name)
Returns the value of the attribute cast in the expected type T, ornull
if 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> T
getComponent(Class<T> componentClass)
<T> T
getInternalAttribute(String name)
Returns the value of the internal attribute cast in the expected type T, ornull
if no attribute for the given name exists.<T> Map<String,T>
getInternalAttributes()
Get all internal attributes available.io.gravitee.el.TemplateEngine
getTemplateEngine()
Get theTemplateEngine
that can be used to evaluate EL expressions.void
putAttribute(String name, Object value)
Stores an attribute in this request.void
putInternalAttribute(String name, Object value)
Stores an internal attribute in this request.void
removeAttribute(String name)
Removes an attribute from this request.void
removeInternalAttribute(String name)
Removes an internal attribute from this request.GenericRequest
request()
Get the current request stuck to this execution context.GenericResponse
response()
Get the current response stuck to this execution context.void
setAttribute(String name, Object value)
Same aputAttribute(String, Object)
.void
setInternalAttribute(String name, Object value)
-
-
-
Method Detail
-
request
GenericRequest request()
Get the current request stuck to this execution context.- Returns:
- the request attached to this execution context.
-
response
GenericResponse response()
Get the current response stuck to this execution context.- Returns:
- the response attached to this execution context.
-
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, ornull
if no attribute for the given name exists.- Type Parameters:
T
- the expected type of the attribute value. SpecifyObject
if 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. SpecifyObject
if 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 attributes 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, ornull
if no attribute for the given name exists.- Type Parameters:
T
- the expected type of the attribute value. SpecifyObject
if 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 not intended to 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. SpecifyObject
if you expect values of any types.- Returns:
- the list of all the internal attributes.
-
getTemplateEngine
io.gravitee.el.TemplateEngine getTemplateEngine()
Get theTemplateEngine
that can be used to evaluate EL expressions.- Returns:
- the El
TemplateEngine
.
-
-