org.glassfish.jersey.server.spi

## Interface ExternalRequestScope<T>

Type Parameters:
  `T` - external request context type

All Superinterfaces:
  AutoCloseable

    public interface ExternalRequestScope<T>
    extends 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

All Methods Instance Methods Abstract Methods
`void` `close()` Finish the actual request.
`ExternalRequestContext<T>` `open(org.glassfish.jersey.internal.inject.InjectionManager injectionManager)` Invoked when a new request gets started.
`void` `resume(ExternalRequestContext<T> c, org.glassfish.jersey.internal.inject.InjectionManager injectionManager)` Resume request associated with provided context.
`void` `suspend(ExternalRequestContext<T> c, org.glassfish.jersey.internal.inject.InjectionManager injectionManager)` Suspend request associated with provided context.

### Method Detail

#### open

    ExternalRequestContext<T> open(org.glassfish.jersey.internal.inject.InjectionManager injectionManager)

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

    void suspend(ExternalRequestContext<T> c,
                 org.glassfish.jersey.internal.inject.InjectionManager injectionManager)

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 context
  `injectionManager` - DI injection manager

#### resume

    void resume(ExternalRequestContext<T> c,
                org.glassfish.jersey.internal.inject.InjectionManager injectionManager)

Resume request associated with provided context. The external request context instance should have been previously suspended.

Parameters:
  `c` - external request context
  `injectionManager` - 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 interface `AutoCloseable`