Package org.glassfish.jersey.server.spi
Interface ExternalRequestScope<T>
- Type Parameters:
T
- external request context type
- All Superinterfaces:
AutoCloseable
This is to allow integration with other DI providers that
define their own request scope. Any such provider should implement
this to properly open/finish the scope.
An implementation must be registered via META-INF/services mechanism. Only one implementation will be utilized during runtime. If more than one implementation is registered, no one will get used and an error message will be logged out.
- Since:
- 2.15
- Author:
- Jakub Podlesak
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Finish the actual request.open
(InjectionManager injectionManager) Invoked when a new request gets started.void
resume
(ExternalRequestContext<T> c, InjectionManager injectionManager) Resume request associated with provided context.void
suspend
(ExternalRequestContext<T> c, InjectionManager injectionManager) Suspend request associated with provided context.
-
Method Details
-
open
Invoked when a new request gets started. Returned context data will be retained by Jersey runtime for the whole request life-span.- Parameters:
injectionManager
- DI injection manager- Returns:
- external request context data
-
suspend
Suspend request associated with provided context. This will be called within the very same thread as previous open or resume call corresponding to the actual context.- Parameters:
c
- external request contextinjectionManager
- DI injection manager
-
resume
Resume request associated with provided context. The external request context instance should have been previously suspended.- Parameters:
c
- external request contextinjectionManager
- DI injection manager
-
close
void close()Finish the actual request. This method will be called following previous open method call on the very same thread or after open method call followed by (several) suspend/resume invocations, where the last resume call has been invoked on the same thread as the final close method invocation.- Specified by:
close
in interfaceAutoCloseable
-