Package org.keycloak.common.util
Class Resteasy
java.lang.Object
org.keycloak.common.util.Resteasy
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
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
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.
-
Constructor Details
-
Resteasy
public Resteasy()
-
-
Method Details
-
getProvider
-
pushContext
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
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. -
pushDefaultContextObject
Push the giveninstance
with type/keytype
to the Resteasy global context.- Parameters:
type
- the type/key to associate theinstance
withinstance
- the instance
-