RequestBody

The {@link oajr.RequestBody} object is the API for accessing the body of an HTTP request.
It can be accessed by passing it as a parameter on your REST Java method:

@RestMethod(...) public Object myMethod(RequestBody body) {...}

##### Example:

@RestMethod(...) public void doPost(RequestBody body) { // Convert body to a linked list of Person objects. List<Person> l = body.asType(LinkedList. class, Person. class); ... }

Some important methods on this class are:

- {@link oajr.RequestBody}
  - {@link oajr.RequestBody#getReader() getReader()} - Get body as a Reader.
  - {@link oajr.RequestBody#getInputStream() getInputStream()} - Get body as an InputStream.
  - {@link oajr.RequestBody#asType(Class) asType(Class)} - Get body converted to a POJO.
  - {@link oajr.RequestBody#asType(Type,Type...) asType(Type,Type...)} - Get body converted to a map or collection of POJOs.
  - {@link oajr.RequestBody#asString() asString()} - Get body as a simple string.
  - {@link oajr.RequestBody#asHex() asHex()} - Get body as a hex-encoded string.
  - {@link oajr.RequestBody#asSpacedHex() asSpacedHex()} - Get body as spaced-hex-encoded string.

##### See Also:

- {@link oaj.http.annotation.Body}