Annotation Type 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
See Also:
-
Optional Element Summary
-
Element Details
-
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:
- ""
-