Annotation Interface HasQuery
Identifies whether or not an HTTP request has the specified query parameter.
Can be used in the following locations:
- Arguments and argument-types of server-side
@RestOp -annotated methods.
Identical to @HasFormData, but only checks the existing of the parameter in the URL string, not
URL-encoded form posts.
Unlike @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 @Cpmtemt annotation or
RestRequest.getContent() method for
Example:
This is functionally equivalent to the following code:
The parameter type must be either Boolean.
The following table shows the behavioral differences between
-
Optional Element Summary
Optional Elements
-
Element Details
-
description
Optional description for the exposed API.- Returns:
- The annotation value.
- Since:
- 9.2.0
- Default:
- {}
-
name
URL query parameter name. Required. The name of the parameter. Parameter names are case sensitive.Notes:
- The format is plain-text.
- Returns:
- The annotation value.
- Default:
- ""
-
value
A synonym forname().Allows you to use shortened notation if you're only specifying the name.
The following are completely equivalent ways of defining the existence of a query entry:
public Order placeOrder(@HasQuery (name="petId" )boolean hasPetId ) {...}public Order placeOrder(@HasQuery ("petId" )boolean hasPetId ) {...}- Returns:
- The annotation value.
- Default:
- ""
-