public interface RequestContextController
@Inject private RequestContextController requestContextController; public void doRequest(String body) { // activate request context requestContextController.activate(); // do work in a request context. // deactivate the request context requestContextController.deactivate(); }Once the request context has been deactivated, you may activate it once again, creating a brand new request context. The activated request context is bound to the current thread, any injection points targeting a request scoped bean will be satisfied with the same request scoped objects.
Modifier and Type | Method and Description |
---|---|
boolean |
activate()
Activates a RequestContext for the current thread if one is not already active.
|
void |
deactivate()
Deactivates the current Request Context if it was activated by this context controller.
|
boolean activate()
void deactivate() throws ContextNotActiveException
ContextNotActiveException
is thrown.ContextNotActiveException
- if the context is not activeCopyright © 2019 JBoss by Red Hat. All rights reserved.