Interface Request
- All Known Subinterfaces:
ActionRequest
,CreateRequest
,DeleteRequest
,PatchRequest
,QueryRequest
,ReadRequest
,UpdateRequest
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The name of the field which contains the additional query parameters in the JSON representation.static final String
The name of the field which contains the fields in the JSON representation.static final String
The name of the field which contains the resource name in the JSON representation.static final String
The value of the fields request parameter to request all fields. -
Method Summary
Modifier and TypeMethodDescription<R,
P> R accept
(RequestVisitor<R, P> v, P p) Applies aRequestVisitor
to thisRequest
.Adds one or more fields which should be included with each JSON resource returned by this request.addField
(JsonPointer... fields) Adds one or more fields which should be included with each JSON resource returned by this request.getAdditionalParameter
(String name) Returns the additional parameter which should be used to control the behavior of this action request.Returns the additional parameters which should be used to control the behavior of this action request.Returns the list of fields which should be included with each JSON resource returned by this request.Get the locale preference for the request.Returns the type of this request.Returns the non-null
path of the JSON resource to which this request should be targeted.Returns the non-null
path of the JSON resource to which this request should be targeted.Gets the requested API version of the resource.setAdditionalParameter
(String name, String value) Sets an additional parameter which should be used to control the behavior of this action request.setPreferredLocales
(PreferredLocales preferredLocales) Set the locale preference for the request.setResourcePath
(String path) Sets the non-null
path of the JSON resource to which this request should be targeted.setResourcePath
(ResourcePath path) Sets the non-null
path of the JSON resource to which this request should be targeted.setResourceVersion
(Version resourceVersion) Sets the requested API version of the resource.Return a JsonValue representation of this request.
-
Field Details
-
FIELD_ADDITIONAL_PARAMETERS
The name of the field which contains the additional query parameters in the JSON representation.- See Also:
-
FIELD_FIELDS
The name of the field which contains the fields in the JSON representation.- See Also:
-
FIELD_VALUE_ALL
The value of the fields request parameter to request all fields.- See Also:
-
FIELD_RESOURCE_PATH
The name of the field which contains the resource name in the JSON representation.- See Also:
-
-
Method Details
-
accept
Applies aRequestVisitor
to thisRequest
.- Type Parameters:
R
- The return type of the visitor's methods.P
- The type of the additional parameters to the visitor's methods.- Parameters:
v
- The request visitor.p
- Optional additional visitor parameter.- Returns:
- A result as specified by the visitor.
-
addField
Adds one or more fields which should be included with each JSON resource returned by this request.- Parameters:
fields
- The fields which should be included with each JSON resource returned by this request.- Returns:
- This request.
- Throws:
UnsupportedOperationException
- If this request does not permit changes to the fields.
-
addField
Adds one or more fields which should be included with each JSON resource returned by this request.- Parameters:
fields
- The fields which should be included with each JSON resource returned by this request.- Returns:
- This request.
- Throws:
IllegalArgumentException
- If one or more of the provided field identifiers could not be parsed as a JSON pointer.UnsupportedOperationException
- If this request does not permit changes to the fields.
-
getAdditionalParameter
Returns the additional parameter which should be used to control the behavior of this action request.- Parameters:
name
- The name of the additional parameter.- Returns:
- The additional parameter which should be used to control the behavior of this action request
-
getAdditionalParameters
Returns the additional parameters which should be used to control the behavior of this action request. The returned map may be modified if permitted by this action request.- Returns:
- The additional parameters which should be used to control the behavior of this action request (never
null
).
-
getFields
List<JsonPointer> getFields()Returns the list of fields which should be included with each JSON resource returned by this request. The returned list may be modified if permitted by this query request. An empty list indicates that all fields should be included.NOTE: field filtering alters the structure of a JSON resource and MUST only be performed once while processing a request. It is therefore the responsibility of front-end implementations (e.g. HTTP listeners, Servlets, etc) to perform field filtering. Request handler and resource provider implementations SHOULD NOT filter fields, but MAY choose to optimise their processing in order to return a resource containing only the fields targeted by the field filters.
- Returns:
- The list of fields which should be included with each JSON resource returned by this request (never
null
).
-
getPreferredLocales
PreferredLocales getPreferredLocales()Get the locale preference for the request.- Returns:
- The
PreferredLocales
instance for the request.
-
getRequestType
RequestType getRequestType()Returns the type of this request.- Returns:
- The type of this request.
-
getResourcePath
String getResourcePath()Returns the non-null
path of the JSON resource to which this request should be targeted. The resource path is relative and never begins or ends with a forward slash, but may be empty.NOTE: for resource provider implementations the resource path is relative to the current resource being accessed. See the description of
UriRouterContext
for more information.- Returns:
- The non-
null
path of the JSON resource to which this request should be targeted, which may be the empty string.
-
getResourcePathObject
ResourcePath getResourcePathObject()Returns the non-null
path of the JSON resource to which this request should be targeted. The resource path is relative and never begins or ends with a forward slash, but may be empty.NOTE: for resource provider implementations the resource path is relative to the current resource being accessed. See the description of
UriRouterContext
for more information.- Returns:
- The non-
null
path of the JSON resource to which this request should be targeted, which may be the empty string.
-
getResourceVersion
Version getResourceVersion()Gets the requested API version of the resource.- Returns:
- The requested API version of the resource.
-
setAdditionalParameter
Sets an additional parameter which should be used to control the behavior of this action request.- Parameters:
name
- The name of the additional parameter.value
- The additional parameter's value.- Returns:
- This request.
- Throws:
BadRequestException
- If this request does not permit the additional parameter to be set.UnsupportedOperationException
- If this request does not permit changes to the additional parameters.
-
setPreferredLocales
Set the locale preference for the request.- Parameters:
preferredLocales
- ThePreferredLocales
instance for the request.- Returns:
- This request.
-
setResourcePath
Sets the non-null
path of the JSON resource to which this request should be targeted. The resource path is relative and never begins or ends with a forward slash, but may be empty.NOTE: for resource provider implementations the resource path is relative to the current resource being accessed. See the description of
UriRouterContext
for more information.- Parameters:
path
- The non-null
path of the JSON resource to which this request should be targeted, which may be the empty string. The path should be URL-encoded.- Returns:
- This request.
- Throws:
UnsupportedOperationException
- If this request does not permit changes to the JSON resource path.
-
setResourcePath
Sets the non-null
path of the JSON resource to which this request should be targeted. The resource path is relative and never begins or ends with a forward slash, but may be empty.NOTE: for resource provider implementations the resource path is relative to the current resource being accessed. See the description of
UriRouterContext
for more information.- Parameters:
path
- The non-null
path of the JSON resource to which this request should be targeted, which may be the empty string.- Returns:
- This request.
- Throws:
UnsupportedOperationException
- If this request does not permit changes to the JSON resource path.
-
setResourceVersion
Sets the requested API version of the resource.- Parameters:
resourceVersion
- The requested API version of the resource.- Returns:
- This request.
-
toJsonValue
JsonValue toJsonValue()Return a JsonValue representation of this request.- Returns:
- this request as a JsonValue
-