Class ErpHttpRequestExecutor<RequestT extends Request<RequestT,RequestResultT>,RequestResultT extends RequestResult<RequestT,RequestResultT>>
java.lang.Object
com.sap.cloud.sdk.s4hana.connectivity.ErpHttpRequestExecutor<RequestT,RequestResultT>
- Type Parameters:
RequestT- The type of the request to execute.RequestResultT- The type of the result to return.
public class ErpHttpRequestExecutor<RequestT extends Request<RequestT,RequestResultT>,RequestResultT extends RequestResult<RequestT,RequestResultT>>
extends Object
A collection of methods which are commonly called during executions of a request against an ERP system.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute(HttpDestination destination, SerializedRequest<RequestT> serializedRequest) Executes the givenserializedRequestas aHttpUriRequest, returning the body of theHttpResponsereceived.execute(HttpDestination destination, RequestT request, RequestSerializer<RequestT, RequestResultT> requestSerializer) Serializes the given request, executes it, and the deserializes the response.protected com.sap.cloud.sdk.s4hana.connectivity.ErpHttpRequestExecutor.RequestBodyWithHeadergetRequestBodyWithHeader(HttpDestination destination, SerializedRequest<RequestT> request) Returns a wrapper object which encapsulates the HTTP request body and headers.protected URIgetRequestUri(HttpDestination destination, SerializedRequest<RequestT> serializedRequest) Get the request URI.
-
Constructor Details
-
ErpHttpRequestExecutor
public ErpHttpRequestExecutor()
-
-
Method Details
-
execute
@Nonnull public RequestResultT execute(@Nonnull HttpDestination destination, @Nonnull RequestT request, @Nonnull RequestSerializer<RequestT, RequestResultT> requestSerializer) throws RequestSerializationException, RequestExecutionException, DestinationNotFoundException, DestinationAccessExceptionSerializes the given request, executes it, and the deserializes the response.- Parameters:
destination- TheHttpDestinationof this call.request- TheRequestto be executed.requestSerializer- TheRequestSerializerto be used to write the request and read the response.- Returns:
- The body of the response received by the given request.
- Throws:
RequestSerializationException- If the request could not be serializedRequestExecutionException- If any Exception occured during execution of the request.DestinationNotFoundException- If the Destination cannot be found.DestinationAccessException- If the destination is not of type DestinationType.HTTP or there is an issue while accessing destination information.
-
getRequestUri
@Nonnull protected URI getRequestUri(@Nonnull HttpDestination destination, @Nonnull SerializedRequest<RequestT> serializedRequest) Get the request URI.- Parameters:
destination- The destination which is used for the HTTP request.serializedRequest- The serialized request payload.- Returns:
- The target request URI.
-
execute
@Nonnull public String execute(@Nonnull HttpDestination destination, @Nonnull SerializedRequest<RequestT> serializedRequest) throws RequestSerializationException, RequestExecutionException, DestinationNotFoundException, DestinationAccessException Executes the givenserializedRequestas aHttpUriRequest, returning the body of theHttpResponsereceived.- Parameters:
destination- TheHttpDestinationof this call.serializedRequest- TheSerializedRequestto execute.- Returns:
- The body of the response received by the given request.
- Throws:
RequestSerializationException- If the request could not be serialized.RequestExecutionException- If any Exception occured during execution of the request.DestinationNotFoundException- If the Destination cannot be found.DestinationAccessException- If the destination is not of type DestinationType.HTTP or there is an issue while accessing destination information.
-
getRequestBodyWithHeader
@Nonnull protected com.sap.cloud.sdk.s4hana.connectivity.ErpHttpRequestExecutor.RequestBodyWithHeader getRequestBodyWithHeader(HttpDestination destination, @Nonnull SerializedRequest<RequestT> request) Returns a wrapper object which encapsulates the HTTP request body and headers. This method can be overridden to manipulate the request before submitting, e.g. signing queries, adding timestamps.- Parameters:
destination- TheHttpDestinationof this call.request- TheRequestto be executed.- Returns:
- The request body with header.
-
getMeasurements
-