ReaderResource (TODO)

The ReaderResource class is a convenience object for defining thread-safe reusable character-based responses. In essence, it's a container for character data with optional response headers and support for resolving SVL variables.

The class is annotated with {@link oaj.http.annotation.Response @Response} which allows it to be returned as responses by REST methods.

Example:

@RestMethod public Object sayHello(RestRequest req) { // Return a reader resource loaded from a file with support for request-time SVL variables. return ReaderResource.create() .contents(new File("helloWorld.txt")) .varResolver(req.getVarResolver()) .header("Cache-Control", "no-cache") .mediaType(TEXT_PLAIN) .build(); }