Request parameters are matched from the request parameters (GET or POST). The match can be optional as their representation in the request allows it.
Routing:
Route is accepted when a required parameter is present and matched in the request.
Route is accepted when an optional parameter is absent or matched in the request.
Rendering:
For required parameters, the system will select a route to render an URL when the parameter is present and matched in the map.
For optional parameters, the system will select a route to render an URL when the parameter is absent or matched in the map.
<route path="/">
<request-param name="path" qname="gtn:path"/>
</route>
Request parameters are declared by a request-param
element and will match any value by default. A request like "/?path=foo" is mapped to the map (gtn:path=foo). The name
attribute of the request-param
tag defines the request parameter value. This element accepts more configuration:
A value
or a pattern
element that is a child element used to match a constant or a pattern.
A control-mode
attribute with the optional
or required
value indicates if matching is mandatory or not.
A value-mapping
attribute with the possible values, such as canonical
, never-empty
, never-null
can be used to filter values after matching is done. For instance, a parameter configured with value-mapping="never-empty"
and matched with the empty string value will not put the empty string in the map.