Class RestApiBase
- java.lang.Object
-
- io.helidon.integrations.common.rest.RestApiBase
-
- All Implemented Interfaces:
RestApi
- Direct Known Subclasses:
OciRestApi,VaultRestApi
public abstract class RestApiBase extends Object implements RestApi
Base REST API implementation. Each integration module is expected to have its own implementation of this class to handle system specific operations, such as security, processing of headers etc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.helidon.integrations.common.rest.RestApi
RestApi.Builder<B extends RestApi.Builder<B,T>,T extends RestApi>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRestApiBase(RestApi.Builder<?,?> builder)A new instance, requires a subclass of theRestApi.Builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddHeaders(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)Add HTTP headers.protected voidaddQueryParams(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)Add HTTP query parameters.protected <T> Single<T>emptyResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ResponseBuilder<?,T,?> responseBuilder)Empty response, may be because of aHttp.Status.NOT_FOUND_404, or some other status, such asHttp.Status.NOT_MODIFIED_304.protected <T extends ApiResponse>
Single<T>errorResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response)Create an error response.protected FtHandlerftHandler()Fault tolerance handler to use to invoke requests.protected <R,T extends ApiOptionalResponse<R>>
Single<T>handleBytesResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiOptionalResponse.BuilderBase<?,T,byte[],R> responseBuilder)Handle bytes response for optional bytes entity.protected <T extends ApiEntityResponse>
Single<T>handleJsonResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiEntityResponse.Builder<?,T,JsonObject> responseBuilder)Reads JsonObject from response entity and either calls thejsonOkResponseorerrorResponsedepending on its success.protected <R,T extends ApiOptionalResponse<R>>
Single<T>handleOptionalJsonResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiOptionalResponse.BuilderBase<?,T,JsonObject,R> responseBuilder)Handle response for optional JSON entity.protected <R,T extends ApiOptionalResponse<R>>
Single<T>handlePublisherResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiOptionalResponse.BuilderBase<?,T,Multi<DataChunk>,R> responseBuilder)Handle response for optional publisher entity.protected <T extends ApiResponse>
Single<T>handleResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiResponse.Builder<?,T> responseBuilder)Handle response for a request not expecting an entity.<T extends ApiResponse>
Single<T>invoke(Http.RequestMethod method, String path, ApiRequest<?> request, ApiResponse.Builder<?,T> responseBuilder)Invoke a request that is not expected to yield an entity.<T extends ApiResponse>
Single<T>invokeBytesRequest(Http.RequestMethod method, String path, ApiRequest<?> request, Flow.Publisher<DataChunk> byteRequest, ApiResponse.Builder<?,T> responseBuilder)The request media type should be provided in request, falls back toMediaType.APPLICATION_OCTET_STREAM.<R,T extends ApiOptionalResponse<R>>
Single<T>invokeBytesResponse(Http.RequestMethod method, String path, ApiRequest<?> request, ApiOptionalResponse.BuilderBase<?,T,byte[],R> responseBuilder)Invoke API call that is expected to return bytes.<R,T extends ApiOptionalResponse<R>>
Single<T>invokeOptional(Http.RequestMethod method, String path, ApiRequest<?> request, ApiOptionalResponse.BuilderBase<?,T,JsonObject,R> responseBuilder)Invoke a request that may yield an entity.<R,T extends ApiOptionalResponse<R>>
Single<T>invokePublisherResponse(Http.RequestMethod method, String path, ApiRequest<?> request, ApiOptionalResponse.BuilderBase<?,T,Multi<DataChunk>,R> responseBuilder)Invoke API call that is expected to return bytes as a publisher.<T extends ApiEntityResponse>
Single<T>invokeWithResponse(Http.RequestMethod method, String path, ApiRequest<?> request, ApiEntityResponse.Builder<?,T,JsonObject> responseBuilder)Invoke a request that is expected to yield an entity.protected booleanisEntityExpected(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, Http.ResponseStatus status)This method is only called for methods that return an optional entity.protected booleanisSuccess(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, Http.ResponseStatus status)Provide information whether the response is a success response for requests with optional entity.protected JsonBuilderFactoryjsonBuilderFactory()JSON builder factory.protected <T> TjsonOkResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, JsonObject json, ResponseBuilder<?,T,JsonObject> responseBuilder)Builds the response using the response builder provided.protected JsonReaderFactoryjsonReaderFactory()JSON reader factory.protected JsonWriterFactoryjsonWriterFactory()JSON writer factory.protected <T extends ApiResponse>
Single<T>noEntityOkResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiResponse.Builder<?,T> responseBuilder)Create a response for no entity.protected ThrowablereadError(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response)Read error with no entity (content length set to 0).protected ThrowablereadError(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, String entity)Read error with an entity that failed to be parsed into a JSON object.protected ThrowablereadError(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, JsonObject errorObject)Read error with a JSON entity.protected ThrowablereadErrorFailedEntity(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, Throwable throwable)Read error information when we failed to read resposen entity.protected Supplier<Single<WebClientResponse>>requestBytesPayload(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientRequestBuilder requestBuilder, Flow.Publisher<DataChunk> publisher)Create a supplier for a response with publisher request.protected StringrequestId(ApiRequest<?> restRequest)Attempts to find a good request id.protected Supplier<Single<WebClientResponse>>requestJsonPayload(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientRequestBuilder requestBuilder, JsonObject jsonObject)Create a supplier for a response with JSON request.protected Supplier<Single<WebClientResponse>>requestPayload(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientRequestBuilder requestBuilder)Create a supplier for a response.protected Supplier<Single<WebClientResponse>>responseSupplier(Http.RequestMethod method, String path, ApiRequest<?> request, String requestId)Create a response supplier from the request.protected Single<WebClientRequestBuilder>updateRequestBuilder(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)Update request builder with no request payload.protected Single<WebClientRequestBuilder>updateRequestBuilder(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, JsonObject jsonObject)Update request builder with no request payload.protected Single<WebClientRequestBuilder>updateRequestBuilderBytesPayload(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)Update request builder with publisher request payload.protected Single<WebClientRequestBuilder>updateRequestBuilderCommon(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)Update request builder used by all default implementation inRestApiBase.protected WebClientwebClient()WebClient to be used to invoke requests.
-
-
-
Constructor Detail
-
RestApiBase
protected RestApiBase(RestApi.Builder<?,?> builder)
A new instance, requires a subclass of theRestApi.Builder.- Parameters:
builder- builder to set this instance from
-
-
Method Detail
-
invoke
public <T extends ApiResponse> Single<T> invoke(Http.RequestMethod method, String path, ApiRequest<?> request, ApiResponse.Builder<?,T> responseBuilder)
Description copied from interface:RestApiInvoke a request that is not expected to yield an entity.- Specified by:
invokein interfaceRestApi- Type Parameters:
T- type of the response- Parameters:
method- HTTP method to invokepath- path to invokerequest- request to use, should be an instance ofApiJsonRequestif and entity is desiredresponseBuilder- builder to construct response from API call- Returns:
- future with metadata if successful. future with error otherwise
-
invokeWithResponse
public <T extends ApiEntityResponse> Single<T> invokeWithResponse(Http.RequestMethod method, String path, ApiRequest<?> request, ApiEntityResponse.Builder<?,T,JsonObject> responseBuilder)
Description copied from interface:RestApiInvoke a request that is expected to yield an entity.- Specified by:
invokeWithResponsein interfaceRestApi- Type Parameters:
T- type of the response- Parameters:
method- HTTP method to invokepath- path to invokerequest- request to use, should be an instance ofApiJsonRequestif and entity is desiredresponseBuilder- builder to construct response from API call- Returns:
- future with entity and metadata if successful, future with error otherwise
-
invokeBytesRequest
public <T extends ApiResponse> Single<T> invokeBytesRequest(Http.RequestMethod method, String path, ApiRequest<?> request, Flow.Publisher<DataChunk> byteRequest, ApiResponse.Builder<?,T> responseBuilder)
Description copied from interface:RestApiThe request media type should be provided in request, falls back toMediaType.APPLICATION_OCTET_STREAM.- Specified by:
invokeBytesRequestin interfaceRestApi- Type Parameters:
T- type of the response- Parameters:
method- method to invokepath- path to invokerequest- request used to configure query parameters and headersbyteRequest- bytes of the entityresponseBuilder- builder to construct response from API call- Returns:
- future with the response or error
-
invokePublisherResponse
public <R,T extends ApiOptionalResponse<R>> Single<T> invokePublisherResponse(Http.RequestMethod method, String path, ApiRequest<?> request, ApiOptionalResponse.BuilderBase<?,T,Multi<DataChunk>,R> responseBuilder)
Description copied from interface:RestApiInvoke API call that is expected to return bytes as a publisher. The accepted media type must be provided in request, falls back toMediaType.APPLICATION_OCTET_STREAM.- Specified by:
invokePublisherResponsein interfaceRestApi- Type Parameters:
R- type of the optional part of the responseT- type of the response- Parameters:
method- method to invokepath- path to invokerequest- request used to configure query parameters and headersresponseBuilder- builder to construct response from API call with appropriate processor to handle the returned publisher- Returns:
- future with the response
-
invokeBytesResponse
public <R,T extends ApiOptionalResponse<R>> Single<T> invokeBytesResponse(Http.RequestMethod method, String path, ApiRequest<?> request, ApiOptionalResponse.BuilderBase<?,T,byte[],R> responseBuilder)
Description copied from interface:RestApiInvoke API call that is expected to return bytes. This method collects all bytes in memory, so it cannot be used for large data. SeeRestApi.invokePublisherResponse(io.helidon.common.http.Http.RequestMethod, String, ApiRequest, io.helidon.integrations.common.rest.ApiOptionalResponse.BuilderBase). The accepted media type must be provided in request, falls back toMediaType.APPLICATION_OCTET_STREAM.- Specified by:
invokeBytesResponsein interfaceRestApi- Type Parameters:
R- type of the optional part of the responseT- type of the response- Parameters:
method- method to invokepath- path to invokerequest- request used to configure query parameters and headersresponseBuilder- builder to construct response from API call with appropriate processor to handle the returned bytes- Returns:
- future with the response
-
invokeOptional
public <R,T extends ApiOptionalResponse<R>> Single<T> invokeOptional(Http.RequestMethod method, String path, ApiRequest<?> request, ApiOptionalResponse.BuilderBase<?,T,JsonObject,R> responseBuilder)
Description copied from interface:RestApiInvoke a request that may yield an entity. The entity is expected to be missing ifHttp.Status.NOT_FOUND_404is returned by the API call (and for some other cases, such as not modified).- Specified by:
invokeOptionalin interfaceRestApi- Type Parameters:
R- type of the optional part of the responseT- type of the response- Parameters:
method- HTTP method to invokepath- path to invokerequest- request to use, should be an instance ofApiJsonRequestif and entity is desiredresponseBuilder- response builder with appropriate processor to create the optional part- Returns:
- future with optional entity, and metadata if successful; future with error otherwise
-
responseSupplier
protected Supplier<Single<WebClientResponse>> responseSupplier(Http.RequestMethod method, String path, ApiRequest<?> request, String requestId)
Create a response supplier from the request. This method checks if there is a payload, and prepares the supplier based on this information.- Parameters:
method- HTTP method to invokepath- path to invokerequest- request that may contain a JSON entityrequestId- request ID to use for this request- Returns:
- supplier of response that is used with fault tolerance
-
addQueryParams
protected void addQueryParams(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)
Add HTTP query parameters. This method adds query parameter configured on the providedApiRequest.- Parameters:
requestBuilder- web client request builder to configure query parameters onpath- requested pathrequest- API requestmethod- HTTP methodrequestId- request ID
-
addHeaders
protected void addHeaders(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)
Add HTTP headers. This method adds headers configured on the providedApiRequest.- Parameters:
requestBuilder- web client request builder to configure headers onpath- requested pathrequest- API requestmethod- HTTP methodrequestId- request ID
-
handleBytesResponse
protected <R,T extends ApiOptionalResponse<R>> Single<T> handleBytesResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiOptionalResponse.BuilderBase<?,T,byte[],R> responseBuilder)
Handle bytes response for optional bytes entity. This method checks if this was a success and if the response should contain an entity. For success, it returns a response using the provided response builder. For failures, returns an error.- Type Parameters:
R- type of the optional part of the responseT- type of the response- Parameters:
path- requested pathrequest- API requestmethod- HTTP methodrequestId- request IDresponse- the web client responseresponseBuilder- builder to configure success response- Returns:
- future with response
-
handlePublisherResponse
protected <R,T extends ApiOptionalResponse<R>> Single<T> handlePublisherResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiOptionalResponse.BuilderBase<?,T,Multi<DataChunk>,R> responseBuilder)
Handle response for optional publisher entity. This method checks if this was a success and if the response should contain an entity. For success, it returns a response using the provided response builder. For failures, returns an error.- Type Parameters:
R- type of the optional part of the responseT- type of the response- Parameters:
path- requested pathrequest- API requestmethod- HTTP methodrequestId- request IDresponse- the web client responseresponseBuilder- builder to configure success response- Returns:
- future with response
-
isSuccess
protected boolean isSuccess(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, Http.ResponseStatus status)
Provide information whether the response is a success response for requests with optional entity.- Parameters:
path- requested pathrequest- API requestmethod- HTTP methodrequestId- request IDstatus- returned HTTP status- Returns:
truefor success states,falsefor errors
-
isEntityExpected
protected boolean isEntityExpected(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, Http.ResponseStatus status)
This method is only called for methods that return an optional entity. If a method (such asRestApi.invokeWithResponse(io.helidon.common.http.Http.RequestMethod, String, ApiRequest, io.helidon.integrations.common.rest.ApiEntityResponse.Builder)) receives a status that would not yield an entity (such as 404), it is automatically an error. Also this method is never called for codes in the success family.- Parameters:
path- requested pathrequest- API requestmethod- HTTP methodrequestId- request IDstatus- returned HTTP status- Returns:
trueif entity is expected,falseotherwise (such as for 404 status code)
-
handleOptionalJsonResponse
protected <R,T extends ApiOptionalResponse<R>> Single<T> handleOptionalJsonResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiOptionalResponse.BuilderBase<?,T,JsonObject,R> responseBuilder)
Handle response for optional JSON entity. This method checks if this was a success and if the response should contain an entity. For success, it returns a response using the provided response builder. For failures, returns an error.- Type Parameters:
R- type of the optional part of the responseT- type of the response- Parameters:
path- requested pathrequest- API requestmethod- HTTP methodrequestId- request IDresponse- the web client responseresponseBuilder- builder to configure success response- Returns:
- future with response
-
emptyResponse
protected <T> Single<T> emptyResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ResponseBuilder<?,T,?> responseBuilder)
Empty response, may be because of aHttp.Status.NOT_FOUND_404, or some other status, such asHttp.Status.NOT_MODIFIED_304.- Type Parameters:
T- type of the response- Parameters:
path- requested pathrequest- original requestmethod- HTTP methodrequestId- ID of the requestresponse- actual response where we do not expect an entityresponseBuilder- builder to create a response instance- Returns:
- typed response with no entity
-
jsonOkResponse
protected <T> T jsonOkResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, JsonObject json, ResponseBuilder<?,T,JsonObject> responseBuilder)
Builds the response using the response builder provided. This is the last chance to update the response builder with system specific information.- Type Parameters:
T- type of the response- Parameters:
path- requested pathrequest- original requestmethod- HTTP methodrequestId- ID of the requestresponse- actual response where we do not expect an entityjson- the JsonObject parsed from entityresponseBuilder- builder to create a response instance- Returns:
- typed response
-
handleJsonResponse
protected <T extends ApiEntityResponse> Single<T> handleJsonResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiEntityResponse.Builder<?,T,JsonObject> responseBuilder)
Reads JsonObject from response entity and either calls thejsonOkResponseorerrorResponsedepending on its success.- Type Parameters:
T- type of the response- Parameters:
path- requested pathrequest- original requestmethod- HTTP methodrequestId- ID of the requestresponse- actual response where we do not expect an entityresponseBuilder- builder to create a response instance- Returns:
- future with typed response
-
handleResponse
protected <T extends ApiResponse> Single<T> handleResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiResponse.Builder<?,T> responseBuilder)
Handle response for a request not expecting an entity.- Type Parameters:
T- type of the response- Parameters:
path- requested pathrequest- original requestmethod- HTTP methodrequestId- ID of the requestresponse- actual response where we do not expect an entityresponseBuilder- builder to create a response instance- Returns:
- future with typed response
-
errorResponse
protected <T extends ApiResponse> Single<T> errorResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response)
Create an error response. This method attempts to read the response entity as a string, parse it into a JsonObject and depending on result, calls methods to create a proper exception.- Type Parameters:
T- type of the response- Parameters:
path- requested pathrequest- original requestmethod- HTTP methodrequestId- ID of the requestresponse- actual response where we do not expect an entity- Returns:
- future with error
-
readErrorFailedEntity
protected Throwable readErrorFailedEntity(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, Throwable throwable)
Read error information when we failed to read resposen entity.- Parameters:
path- requested pathrequest- original requestmethod- HTTP methodrequestId- ID of the requestresponse- actual response where we do not expect an entitythrowable- throwable that caused this problem (such as parsing exception)- Returns:
- throwable to be used in response
-
readError
protected Throwable readError(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, String entity)
Read error with an entity that failed to be parsed into a JSON object.- Parameters:
path- requested pathrequest- original API requestmethod- HTTP methodrequestId- request IDresponse- web client response with entity consumedentity- entity as a string- Returns:
- a throwable to be used in response
-
readError
protected Throwable readError(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response)
Read error with no entity (content length set to 0).- Parameters:
path- requested pathrequest- original API requestmethod- HTTP methodrequestId- request IDresponse- web client response with entity consumed- Returns:
- a throwable to be used in response
-
readError
protected Throwable readError(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, JsonObject errorObject)
Read error with a JSON entity.- Parameters:
path- requested pathrequest- original API requestmethod- HTTP methodrequestId- request IDresponse- web client response with entity consumederrorObject- entity as a JSON object- Returns:
- a throwable to be used in response
-
noEntityOkResponse
protected <T extends ApiResponse> Single<T> noEntityOkResponse(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientResponse response, ApiResponse.Builder<?,T> responseBuilder)
Create a response for no entity. This method builds the response from builder.- Type Parameters:
T- type of the response- Parameters:
path- requested pathrequest- original API requestmethod- HTTP methodrequestId- request IDresponse- web client response with entity consumedresponseBuilder- response builder- Returns:
- future with the typed response
-
requestJsonPayload
protected Supplier<Single<WebClientResponse>> requestJsonPayload(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientRequestBuilder requestBuilder, JsonObject jsonObject)
Create a supplier for a response with JSON request. Defaults to "() -> clientRequest.submit(jsonObject)". Also configures content type and accept headers.- Parameters:
path- path requestedrequest- API requestmethod- HTTP methodrequestId- ID of this requestrequestBuilder-WebClientrequest builderjsonObject- JSON object that should be sent as a request entity- Returns:
- supplier of a web client response
-
requestBytesPayload
protected Supplier<Single<WebClientResponse>> requestBytesPayload(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientRequestBuilder requestBuilder, Flow.Publisher<DataChunk> publisher)
Create a supplier for a response with publisher request. Defaults to "() -> clientRequest.submit(publisher)". Also configures content type and accept headers.- Parameters:
path- path requestedrequest- API requestmethod- HTTP methodrequestId- ID of this requestrequestBuilder-WebClientrequest builderpublisher- publisher to be used as request entity- Returns:
- supplier of a web client response
-
requestPayload
protected Supplier<Single<WebClientResponse>> requestPayload(String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, WebClientRequestBuilder requestBuilder)
Create a supplier for a response. Defaults torequestBuilder::request.- Parameters:
path- path requestedrequest- API requestmethod- HTTP methodrequestId- ID of this requestrequestBuilder-WebClientrequest builder- Returns:
- supplier of a web client response
-
updateRequestBuilder
protected Single<WebClientRequestBuilder> updateRequestBuilder(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)
Update request builder with no request payload. Default implementation does nothing.- Parameters:
requestBuilder- current request builderpath- path to be executedrequest- API requestmethod- methodrequestId- request ID- Returns:
- updated builder
-
updateRequestBuilderBytesPayload
protected Single<WebClientRequestBuilder> updateRequestBuilderBytesPayload(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)
Update request builder with publisher request payload. Default implementation does nothing.- Parameters:
requestBuilder- current request builderpath- path to be executedrequest- API requestmethod- methodrequestId- request ID- Returns:
- updated builder
-
updateRequestBuilder
protected Single<WebClientRequestBuilder> updateRequestBuilder(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId, JsonObject jsonObject)
Update request builder with no request payload. Default implementation does nothing.- Parameters:
requestBuilder- current request builderpath- path to be executedrequest- API requestmethod- methodrequestId- request IDjsonObject- json object with the request- Returns:
- updated builder
-
updateRequestBuilderCommon
protected Single<WebClientRequestBuilder> updateRequestBuilderCommon(WebClientRequestBuilder requestBuilder, String path, ApiRequest<?> request, Http.RequestMethod method, String requestId)
Update request builder used by all default implementation inRestApiBase.- Parameters:
requestBuilder- current request builderpath- path to be executedrequest- API requestmethod- methodrequestId- request ID- Returns:
- updated builder
-
requestId
protected String requestId(ApiRequest<?> restRequest)
Attempts to find a good request id. This looks in the following (sequentially):ApiRestRequest.requestId()- Trace ID of the current span if one is present (obtained from
Context - Random UUID
- Parameters:
restRequest- request- Returns:
- request ID
-
webClient
protected WebClient webClient()
WebClient to be used to invoke requests.- Returns:
- web client
-
ftHandler
protected FtHandler ftHandler()
Fault tolerance handler to use to invoke requests.- Returns:
- fault tolerance handler
-
jsonBuilderFactory
protected JsonBuilderFactory jsonBuilderFactory()
JSON builder factory.- Returns:
- builder factory
-
jsonReaderFactory
protected JsonReaderFactory jsonReaderFactory()
JSON reader factory.- Returns:
- reader factory
-
jsonWriterFactory
protected JsonWriterFactory jsonWriterFactory()
JSON writer factory.- Returns:
- writer factory
-
-