Class ApiRestRequest<T extends ApiRequest<T>>
java.lang.Object
io.helidon.integrations.common.rest.ApiRestRequest<T>
- Type Parameters:
T
- type of the request
- All Implemented Interfaces:
ApiRequest<T>
- Direct Known Subclasses:
RestRequest
public abstract class ApiRestRequest<T extends ApiRequest<T>>
extends Object
implements ApiRequest<T>
Common base class for REST requests.
This class acts as a mutable builder without a build method, as the intended use is to pass it
to a
io.helidon.integrations.common.rest.RestApi
, not to send it around for parallel processing.
Path is not a part of this request.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd an HTTP header.addQueryParam
(String name, String... value) Add an HTTP query parameter.headers()
Returns immutable configured headers.protected T
me()
Can be returned by subclasses that can be subclassed again.Returns immutable configured query parameters.Configured request ID.Configure request ID for logging (and possibly to send over the network).Request media type.requestMediaType
(MediaType mediaType) The media type header, defaults toMediaTypes.APPLICATION_JSON
when JSON entity is present, toMediaTypes.APPLICATION_OCTET_STREAM
for publisher base requests, empty otherwise.Response media type.responseMediaType
(MediaType mediaType) The accept header, defaults toMediaTypes.APPLICATION_JSON
for most requests, except for requests that return publisher, which default toMediaTypes.APPLICATION_OCTET_STREAM
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.helidon.integrations.common.rest.ApiRequest
toJson
-
Constructor Details
-
ApiRestRequest
protected ApiRestRequest()Default constructor.
-
-
Method Details
-
addHeader
Add an HTTP header.- Specified by:
addHeader
in interfaceApiRequest<T extends ApiRequest<T>>
- Parameters:
name
- name of the headervalue
- header value(s)- Returns:
- updated request
-
addQueryParam
Add an HTTP query parameter.- Specified by:
addQueryParam
in interfaceApiRequest<T extends ApiRequest<T>>
- Parameters:
name
- name of the parametervalue
- parameter value(s)- Returns:
- updated request
-
requestMediaType
Description copied from interface:ApiRequest
The media type header, defaults toMediaTypes.APPLICATION_JSON
when JSON entity is present, toMediaTypes.APPLICATION_OCTET_STREAM
for publisher base requests, empty otherwise.- Specified by:
requestMediaType
in interfaceApiRequest<T extends ApiRequest<T>>
- Parameters:
mediaType
- media type of request- Returns:
- updated request
-
responseMediaType
Description copied from interface:ApiRequest
The accept header, defaults toMediaTypes.APPLICATION_JSON
for most requests, except for requests that return publisher, which default toMediaTypes.APPLICATION_OCTET_STREAM
.- Specified by:
responseMediaType
in interfaceApiRequest<T extends ApiRequest<T>>
- Parameters:
mediaType
- accepted media type- Returns:
- updated request
-
requestId
Description copied from interface:ApiRequest
Configure request ID for logging (and possibly to send over the network).- Specified by:
requestId
in interfaceApiRequest<T extends ApiRequest<T>>
- Parameters:
requestId
- request id- Returns:
- updated request
-
headers
Description copied from interface:ApiRequest
Returns immutable configured headers.- Specified by:
headers
in interfaceApiRequest<T extends ApiRequest<T>>
- Returns:
- headers configured for this request
-
queryParams
Description copied from interface:ApiRequest
Returns immutable configured query parameters.- Specified by:
queryParams
in interfaceApiRequest<T extends ApiRequest<T>>
- Returns:
- query parameters configured for this request
-
requestMediaType
Description copied from interface:ApiRequest
Request media type.- Specified by:
requestMediaType
in interfaceApiRequest<T extends ApiRequest<T>>
- Returns:
- media type if configured
- See Also:
-
responseMediaType
Description copied from interface:ApiRequest
Response media type.- Specified by:
responseMediaType
in interfaceApiRequest<T extends ApiRequest<T>>
- Returns:
- media type if configured
- See Also:
-
requestId
Description copied from interface:ApiRequest
Configured request ID.- Specified by:
requestId
in interfaceApiRequest<T extends ApiRequest<T>>
- Returns:
- request ID if configured
-
me
Can be returned by subclasses that can be subclassed again.- Returns:
- this instance as a subclass type
-