RequestFormData

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

@RestMethod(...) public Object myMethod(RequestFormData query) {...}

##### Example:

@RestMethod(...) public Object myMethod(RequestFormData formData) { // Get query parameters converted to various types. int p1 = formData.get("p1", 0, int.class); String p2 = formData.get("p2", String.class); UUID p3 = formData.get("p3", UUID.class); }

Note that this object does NOT take GET parameters into account and only returns values found in the body of the request.

Some important methods on this class are:

- {@link oajr.RequestFormData} extends LinkedHashMap<String,String[]>
  - {@link oajr.RequestFormData#get(String,Class) get(String,Class)} - Get form-data parameter values converted to a POJO.
  - {@link oajr.RequestFormData#get(String,Type,Type...) get(String,Type,Type)} - Get form-data parameter value converted to a map or collection of POJOs.
  - {@link oajr.RequestFormData#getString(String,String) getString(String,String)} - Get form-data parameter value as a simple string.
  - {@link oajr.RequestFormData#getInt(String,int) getInt(String,int)} - Get form-data parameter value as an integer.
  - {@link oajr.RequestFormData#getBoolean(String,boolean) getBoolean(String,boolean)} - Get form-data parameter value as a boolean.
  - {@link oajr.RequestFormData#addDefault(String,Object) addDefault(String,Object)} - Programmatically set a default value for a form-data parameter.

- {@link oaj.http.annotation.FormData}
- {@link oaj.http.annotation.HasFormData}