public final class CurrentContext extends Object
Static utility methods to get a hand on the thread local Context.
Modifier and Type | Method and Description |
---|---|
static Application |
application() |
static HttpBuilders |
builders() |
static Cache |
cache() |
static Crypto |
crypto() |
static ExecutorService |
executor() |
static ApplicationExecutors |
executors() |
static Context |
get() |
static MetaData |
metaData() |
static MimeTypes |
mimeTypes() |
static Optional<Context> |
optional() |
static Outcomes |
outcomes() |
static <T> T |
plugin(Class<T> pluginApiType)
Lookup a Plugin's API.
|
static <T> Iterable<T> |
plugins(Class<T> pluginApiType)
Lookup possibly several Plugin's API.
|
static Request |
request() |
static ResponseHeader |
response() |
static ReverseRoutes |
reverseRoutes() |
static Session |
session() |
static Templates |
templates() |
public static Context get()
WervalException
- if no Context in current Thread
public static Optional<Context> optional()
WervalException
- if no Context in current Thread
public static MetaData metaData()
WervalException
- if no Context in current Thread
public static Application application()
WervalException
- if no Context in current Thread
public static Crypto crypto()
WervalException
- if no Context in current Thread
public static ExecutorService executor()
WervalException
- if no Context in current Thread
public static ApplicationExecutors executors()
WervalException
- if no Context in current Thread
public static <T> T plugin(Class<T> pluginApiType)
Don't hold references to the Plugins API instances in order to make your code Mode.DEV
friendly.
T
- Parameterized Plugin API type
pluginApiType
- Plugin type
IllegalArgumentException
- if no Plugin is found for the given API type
IllegalStateException
- if the Application is not active
public static <T> Iterable<T> plugins(Class<T> pluginApiType)
Don't hold references to the Plugins API instances in order to make your code Mode.DEV
friendly.
T
- Parameterized Plugin API type
pluginApiType
- Plugin type
IllegalStateException
- if the Application is not active
public static ReverseRoutes reverseRoutes()
WervalException
- if no Context in current Thread
public static Session session()
WervalException
- if no Context in current Thread
public static Request request()
WervalException
- if no Context in current Thread
public static ResponseHeader response()
WervalException
- if no Context in current Thread
public static Outcomes outcomes()
WervalException
- if no Context in current Thread
public static HttpBuilders builders()
WervalException
- if no Context in current Thread
public static MimeTypes mimeTypes()
WervalException
- if no Context in current Thread
public static Cache cache()
WervalException
- if no Context in current Thread
public static Templates templates()
WervalException
- if no Context in current Thread