Package org.keycloak.common.util
Class Resteasy
- java.lang.Object
-
- org.keycloak.common.util.Resteasy
-
public final class Resteasy extends Object
Provides a layer of indirection to abstract invocations to Resteasy internal APIs. Making also possible to use different versions of Resteasy (e.g.: v3 and v4) depending on the stack that the server is running.
The methods herein provided are basically related with accessing context data from Resteasy, which changed in latest versions of Resteasy.
It is important to use this class when access to context data is necessary in order to avoid incompatibilities with future versions of Resteasy.
- Author:
- Pedro Igor
-
-
Constructor Summary
Constructors Constructor Description Resteasy()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearContextData()
Clear the Resteasy context associated with the current thread.static <R> R
getContextData(Class<R> type)
Lookup the instance associated with the given type/keytype
from the Resteasy context associated with the current thread.static ResteasyProvider
getProvider()
static void
pushContext(Class type, Object instance)
Push the giveninstance
with type/keytype
to the Resteasy context associated with the current thread.static void
pushDefaultContextObject(Class type, Object instance)
Push the giveninstance
with type/keytype
to the Resteasy global context.
-
-
-
Method Detail
-
getProvider
public static ResteasyProvider getProvider()
-
pushContext
public static void pushContext(Class type, Object instance)
Push the giveninstance
with type/keytype
to the Resteasy context associated with the current thread.- Parameters:
type
- the type/key to associate theinstance
withinstance
- the instance
-
getContextData
public static <R> R getContextData(Class<R> type)
Lookup the instance associated with the given type/keytype
from the Resteasy context associated with the current thread.- Parameters:
type
- the type/key to lookup- Returns:
- the instance associated with the given
type
or null if non-existent.
-
clearContextData
public static void clearContextData()
Clear the Resteasy context associated with the current thread.
-
-