Class RestContext

java.lang.Object
org.apache.juneau.Context
org.apache.juneau.rest.RestContext

public class RestContext extends Context
Defines the initial configuration of a RestServlet or @Rest annotated object.

An extension of the ServletConfig object used during servlet initialization.

Methods are provided for overriding or augmenting the information provided by the @Rest annotation. In general, most information provided in the @Rest annotation can be specified programmatically through calls on this object.

To interact with this object, simply pass it in as a constructor argument or in an INIT hook.

// Option #1 - Pass in through constructor. public MyResource(RestContext.Builder builder) { builder .swaps(TemporalCalendarSwap.IsoLocalDateTime.class); } // Option #2 - Use an init hook. @RestInit public void init(RestContext.Builder builder) throws Exception { builder .swaps(TemporalCalendarSwap.IsoLocalDateTime.class); }

Notes:
  • This class is thread safe and reusable.
See Also: