RequestQuery

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

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

Example:

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

An important distinction between the behavior of this object and HttpServletRequest.getParameter(String) is that the former will NOT load the body of the request on FORM POSTS and will only look at parameters found in the query string. This can be useful in cases where you're mixing GET parameters and FORM POSTS and you don't want to inadvertently read the body of the request to get a query parameter.

Some important methods on this class are: