Class 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 Detail

      • Resteasy

        public Resteasy()
    • Method Detail

      • pushContext

        public static void pushContext​(Class type,
                                       Object instance)
        Push the given instance with type/key type to the Resteasy context associated with the current thread.
        Parameters:
        type - the type/key to associate the instance with
        instance - the instance
      • getContextData

        public static <R> R getContextData​(Class<R> type)
        Lookup the instance associated with the given type/key type 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

        public static void pushDefaultContextObject​(Class type,
                                                    Object instance)
        Push the given instance with type/key type to the Resteasy global context.
        Parameters:
        type - the type/key to associate the instance with
        instance - the instance