RestContext

The {@link oajr.RestContext} object is the workhorse class for all of the configuration of a single REST resource class.
It's by-far the most important class in the REST API.

Every class annotated with @RestResource ends up with an instance of this object.
The object itself is read-only and unchangeable.
It is populated through the following:

- {@link oajr.annotation.RestResource} - Settings copied from the annotation during servlet initialization.
- {@link oajr.RestContextBuilder} - Builder used during servlet initialization.

The annotation should be self-explanatory at this point.
The builder allows you to perform all of the same configuration as the annotation programmatically.

The {@link oajr.RestContextBuilder} class extends {@link oaj.BeanContextBuilder} allowing you to programmatically set any properties defined on that builder class.
It also implements {@link javax.servlet.ServletConfig}

To access this object, simply pass it in as a constructor argument or in an INIT hook:

// Option #1 - Pass in through constructor. public MyResource(RestContextBuilder builder) { builder .pojoSwaps(CalendarSwap.RFC2822DTZ.class) .set(PARSER_debug, true); } // Option #2 - Use an INIT hook. @RestHook(INIT) public void init(RestContextBuilder builder) throws Exception { builder .pojoSwaps(CalendarSwap.RFC2822DTZ.class) .set(PARSER_debug, true); }

Warning: The builder class is huge. Through it, you can configure bean/serializer/parser settings, define config files, children, resource finders, info providers, etc...