public interface ContextsService
For example, web container supports request, session conversation, application, singleton and dependent contexts.
| Modifier and Type | Method and Description |
|---|---|
void |
destroy(Object destroyObject)
Destroys container contexts service.
|
void |
endContext(Class<? extends Annotation> scopeType,
Object endParameters)
Ends the context with the given scope type.
|
javax.enterprise.context.spi.Context |
getCurrentContext(Class<? extends Annotation> scopeType)
Gets current context with given scope type with
respect to the current thread of execution.
|
javax.enterprise.context.spi.Context |
getCurrentContext(Class<? extends Annotation> scopeType,
boolean createIfNotExists)
Gets current context with given scope type with
respect to the current thread of execution.
|
void |
init(Object initializeObject)
Initialize container contexts service.
|
void |
removeThreadLocals()
Whenever a thread ends we need to remove any ThreadLocals from the ContextsService
|
void |
setSupportConversations(boolean supportConversations)
This method can be used to disable conversation support in core CDI.
|
void |
startContext(Class<? extends Annotation> scopeType,
Object startParameter)
Starts the context with the given scope type.
|
void init(Object initializeObject)
initializeObject - any initialize objectvoid destroy(Object destroyObject)
destroyObject - any destroy parameterjavax.enterprise.context.spi.Context getCurrentContext(Class<? extends Annotation> scopeType)
If there is not current context, it returns null.
scopeType - context scope typejavax.enterprise.context.spi.Context getCurrentContext(Class<? extends Annotation> scopeType, boolean createIfNotExists)
If there is not current context, it will try to create one if createIfNotExists is set.
This is mostly usefull for the SessionContext. If there is no HttpSession yet and the
createIfNotExists is set to false then we do not create the HttpSession.
scopeType - context scope typecreateIfNotExists - whether to create a new context if the underlying storage is not yet initializedvoid startContext(Class<? extends Annotation> scopeType, Object startParameter) throws javax.enterprise.context.ContextException
scopeType - scope typestartParameter - any parameterjavax.enterprise.context.ContextException - if any exception thrown by starting context,
it is wrapped inside ContextException and thrown.void endContext(Class<? extends Annotation> scopeType, Object endParameters)
scopeType - scope typeendParameters - any end parametervoid removeThreadLocals()
void setSupportConversations(boolean supportConversations)
supportConversations - whether converstaions should be supportedCopyright © 2008–2019 The Apache Software Foundation. All rights reserved.