@Beta public abstract class ODataRequestGeneric extends Object implements ODataRequestExecutable
Modifier and Type | Field and Description |
---|---|
protected ODataResourcePath |
resourcePath
The
ODataResourcePath that identifies the OData resource to operate on. |
protected String |
servicePath
The service path of the targeted OData service.
|
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String key,
String value)
Add a header to the OData HTTP request.
|
void |
addHeaderIfAbsent(String key,
String value)
Add a header to the OData HTTP request, if it is not included already.
|
void |
addListener(ODataRequestListener listener)
Attach a listener to the request process.
|
void |
addQueryParameter(String key,
String value)
Add a query parameter to the HTTP request.
|
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
protected Map<String,String> |
getHeaders()
Map of HTTP header key-values which are added to the OData request.
|
protected List<ODataRequestListener> |
getListeners()
List of listeners to observe and react on OData actions.
|
ODataProtocol |
getProtocol()
The OData protocol version of this request.
|
protected Map<String,String> |
getQueryParameters()
Map of additional generic HTTP query parameters.
|
abstract URI |
getRelativeUri()
Get the static request URI of the OData resource.
|
String |
getRequestQuery()
Use all OData query information to construct a HTTP request query String.
|
protected ODataResourcePath |
getResourcePath()
The
ODataResourcePath that identifies the OData resource to operate on. |
String |
getServicePath()
The service path of the targeted OData service.
|
int |
hashCode() |
void |
setCsrfTokenRetriever(CsrfTokenRetriever csrfTokenRetriever) |
protected io.vavr.control.Try<ODataRequestResultGeneric> |
tryExecute(Supplier<org.apache.http.HttpResponse> httpOperation,
org.apache.http.client.HttpClient httpClient)
Internal execute method.
|
protected io.vavr.control.Try<ODataRequestResultGeneric> |
tryExecuteWithCsrfToken(org.apache.http.client.HttpClient httpClient,
Supplier<org.apache.http.HttpResponse> httpOperation)
Internal execute method.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
execute
@Nonnull protected final String servicePath
sap/opu/odata/sap/API_BUSINESS_PARTNER
@Nonnull protected final ODataResourcePath resourcePath
ODataResourcePath
that identifies the OData resource to operate on. E.g.
/BusinessPartner('123')/BusinessPartnerAddress(456)
.@Nonnull public abstract URI getRelativeUri()
@Nonnull public String getRequestQuery()
public void addListener(@Nonnull ODataRequestListener listener)
listener
- The listener to react on OData request actions.public void addHeader(@Nonnull String key, @Nullable String value)
key
- The header name.value
- The header value.public void addHeaderIfAbsent(@Nonnull String key, @Nullable String value)
key
- The header name.value
- The header value.public void addQueryParameter(@Nonnull String key, @Nullable String value)
key
- The parameter key.value
- The encoded parameters value.@Nonnull protected io.vavr.control.Try<ODataRequestResultGeneric> tryExecute(@Nonnull Supplier<org.apache.http.HttpResponse> httpOperation, @Nonnull org.apache.http.client.HttpClient httpClient)
ODataException
httpOperation
- The HTTP operation to perform, e.g. ODataHttpRequest.requestGet()
httpClient
- The HTTP client instance that is being used to perform the operation.Try
containing either a successful ODataRequestResultGeneric
or an
ODataException
.@Nonnull protected io.vavr.control.Try<ODataRequestResultGeneric> tryExecuteWithCsrfToken(@Nonnull org.apache.http.client.HttpClient httpClient, @Nonnull Supplier<org.apache.http.HttpResponse> httpOperation)
tryExecute(Supplier, HttpClient)
.
CSRF token retrieval is skipped, if a token is already present. The actual request is performed regardless
whether or not a CSRF token was retrieved.httpClient
- An HttpClient
to execute the CSRF token retrieval.httpOperation
- The HTTP operation to perform, e.g. ODataHttpRequest.requestGet()
Try
containing either a successful ODataRequestResultGeneric
or an
ODataException
.@Nonnull public String getServicePath()
sap/opu/odata/sap/API_BUSINESS_PARTNER
@Nonnull protected ODataResourcePath getResourcePath()
ODataResourcePath
that identifies the OData resource to operate on. E.g.
/BusinessPartner('123')/BusinessPartnerAddress(456)
.public ODataProtocol getProtocol()
protected List<ODataRequestListener> getListeners()
protected Map<String,String> getHeaders()
protected Map<String,String> getQueryParameters()
public void setCsrfTokenRetriever(@Nullable CsrfTokenRetriever csrfTokenRetriever)
Copyright © 2021 SAP SE. All rights reserved.