Interface ApiRequest<T extends ApiRequest<T>>
-
- Type Parameters:
T
- type of the request
- All Known Implementing Classes:
ApiJsonRequest
,ApiRestRequest
,CaCertificateGet.Request
,CertificateGet.Request
,ConfigureK8s.Request
,CreateAppRole.Request
,CreateCubbyhole.Request
,CreateKey.Request
,CreateKv1.Request
,CreateKv2.Request
,CreatePolicy.Request
,CreateRole.Request
,CreateSecret.Request
,CreateToken.Request
,CreateTokenRole.Request
,CrlGet.Request
,DbConfigure.Request
,DbCreateRole.Request
,DbDelete.Request
,DbDeleteRole.Request
,DbGet.Request
,Decrypt.Request
,Decrypt.Request
,DecryptBatch.Request
,DeleteAllKv2.Request
,DeleteAppRole.Request
,DeleteCubbyhole.Request
,DeleteKey.Request
,DeleteKv1.Request
,DeleteKv2.Request
,DeleteObject.Request
,DeletePolicy.Request
,DeleteRole.Request
,DeleteSecret.Request
,DeleteTokenRole.Request
,DestroyKv2.Request
,DestroySecretId.Request
,DisableAuth.Request
,DisableEngine.Request
,EnableAuth.Request
,EnableEngine.Request
,Encrypt.Request
,Encrypt.Request
,EncryptBatch.Request
,GenerateAutonomousDatabaseWallet.Request
,GenerateSecretId.Request
,GenerateSelfSignedRoot.Request
,GetBucket.Request
,GetCubbyhole.Request
,GetKey.Request
,GetKv1.Request
,GetKv2.Request
,GetObject.Request
,GetSecret.Request
,GetSecretBundle.Request
,GetVault.Request
,Hmac.Request
,IssueCertificate.Request
,JsonRequest
,ListSecrets.Request
,Login.Request
,Login.Request
,MySqlConfigureRequest
,ObjectRequest
,OciRequestBase
,OracleConfigureRequest
,PkiRole.Request
,PostMetricData.Request
,PutObject.Request
,ReadRoleId.Request
,RenameObject.Request
,RenewToken.Request
,RestRequest
,RevokeAndOrphanToken.Request
,RevokeCertificate.Request
,RevokeToken.Request
,Sign.Request
,Sign.Request
,SignCsr.Request
,UndeleteKv2.Request
,UpdateCubbyhole.Request
,UpdateKeyConfig.Request
,UpdateKv1.Request
,UpdateKv2.Request
,VaultRequest
,Verify.Request
,Verify.Request
public interface ApiRequest<T extends ApiRequest<T>>
Common base class for REST requests. This class acts as a mutable builder. Path is not a part of this request.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description T
addHeader(String name, String... value)
Add an HTTP header.T
addQueryParam(String name, String... value)
Add an HTTP query parameter.Map<String,List<String>>
headers()
Returns immutable configured headers.Map<String,List<String>>
queryParams()
Returns immutable configured query parameters.Optional<String>
requestId()
Configured request ID.T
requestId(String requestId)
Configure request ID for logging (and possibly to send over the network).Optional<MediaType>
requestMediaType()
Request media type.T
requestMediaType(MediaType mediaType)
The media type header, defaults toMediaType.APPLICATION_JSON
when JSON entity is present, toMediaType.APPLICATION_OCTET_STREAM
for publisher base requests, empty otherwise.Optional<MediaType>
responseMediaType()
Response media type.T
responseMediaType(MediaType mediaType)
The accept header, defaults toMediaType.APPLICATION_JSON
for most requests, except for requests that return publisher, which default toMediaType.APPLICATION_OCTET_STREAM
.default Optional<JsonObject>
toJson(JsonBuilderFactory factory)
Return the JSON object used for POST and PUT requests (and other methods if needed).
-
-
-
Method Detail
-
addHeader
T addHeader(String name, String... value)
Add an HTTP header.- Parameters:
name
- name of the headervalue
- header value(s)- Returns:
- updated request
-
addQueryParam
T addQueryParam(String name, String... value)
Add an HTTP query parameter.- Parameters:
name
- name of the parametervalue
- parameter value(s)- Returns:
- updated request
-
requestMediaType
T requestMediaType(MediaType mediaType)
The media type header, defaults toMediaType.APPLICATION_JSON
when JSON entity is present, toMediaType.APPLICATION_OCTET_STREAM
for publisher base requests, empty otherwise.- Parameters:
mediaType
- media type of request- Returns:
- updated request
-
responseMediaType
T responseMediaType(MediaType mediaType)
The accept header, defaults toMediaType.APPLICATION_JSON
for most requests, except for requests that return publisher, which default toMediaType.APPLICATION_OCTET_STREAM
.- Parameters:
mediaType
- accepted media type- Returns:
- updated request
-
requestId
T requestId(String requestId)
Configure request ID for logging (and possibly to send over the network).- Parameters:
requestId
- request id- Returns:
- updated request
-
headers
Map<String,List<String>> headers()
Returns immutable configured headers.- Returns:
- headers configured for this request
-
queryParams
Map<String,List<String>> queryParams()
Returns immutable configured query parameters.- Returns:
- query parameters configured for this request
-
toJson
default Optional<JsonObject> toJson(JsonBuilderFactory factory)
Return the JSON object used for POST and PUT requests (and other methods if needed). The default implementation returns an empty optional that can be used for GET, HEAD, DELETE methods (and other methods without an entity).- Parameters:
factory
- builder factory to construct JSON object- Returns:
- JSON if available on this request
-
requestMediaType
Optional<MediaType> requestMediaType()
Request media type.- Returns:
- media type if configured
- See Also:
requestMediaType(io.helidon.common.http.MediaType)
-
responseMediaType
Optional<MediaType> responseMediaType()
Response media type.- Returns:
- media type if configured
- See Also:
responseMediaType(io.helidon.common.http.MediaType)
-
-