@HasQuery

Identical to {@link oaj.http.annotation.HasFormData @HasFormData}, but only checks the existing of the parameter in the URL string, not URL-encoded form posts.

Unlike {@link oaj.http.annotation.HasFormData @HasFormData}, using this annotation does not result in the servlet reading the contents of URL-encoded form posts. Therefore, this annotation can be used in conjunction with the {@link oaj.http.annotation.Body @Body} annotation or {@link oajr.RestRequest#getBody()} method for application/x-www-form-urlencoded POST calls.

Example:

@RestMethod(name=GET) public void doGet(@HasQuery("p1") boolean p1) {...}

This is functionally equivalent to the following code:

@RestMethod(name=GET) public void doGet(RestRequest req) { boolean p1 = req.hasQuery("p1"); ... }

The parameter type must be either boolean or {@link java.lang.Boolean}.

The following table shows the behavioral differences between @HasQuery and @Query:

Query content @HasQuery("a") @Query("a")
?a=foo true "foo"
?a= true ""
?a true null
?b=foo false null