public class ServletScopes extends Object
Modifier and Type | Field and Description |
---|---|
static Scope |
REQUEST
HTTP servlet request scope.
|
static Scope |
SESSION
HTTP session scope.
|
Modifier and Type | Method and Description |
---|---|
static <T> Callable<T> |
continueRequest(Callable<T> callable,
Map<Key<?>,Object> seedMap)
Wraps the given callable in a contextual callable that "continues" the
HTTP request in another thread.
|
static <T> Callable<T> |
scopeRequest(Callable<T> callable,
Map<Key<?>,Object> seedMap)
Scopes the given callable inside a request scope.
|
public static final Scope REQUEST
public static final Scope SESSION
public static <T> Callable<T> continueRequest(Callable<T> callable, Map<Key<?>,Object> seedMap)
There are some limitations:
callable
- code to be executed in another thread, which depends on
the request scope.seedMap
- the initial set of scoped instances for Guice to seed the
request scope with. To seed a key with null, use null
as
the value.OutOfScopeException
- if this method is called from a non-request
thread, or if the request has completed.public static <T> Callable<T> scopeRequest(Callable<T> callable, Map<Key<?>,Object> seedMap)
callable
- code to be executed which depends on the request scope.
Typically in another thread, but not necessarily so.seedMap
- the initial set of scoped instances for Guice to seed the
request scope with. To seed a key with null, use null
as
the value.seedMap
as scoped keys.Copyright © 2006-2012 Google, Inc.. All Rights Reserved.