Ich versuche, eine Entität über eine HTTP PUT
Anfrage mit folgendem Code zu übertragen.Wie man eine PUT Anfrage mit Apache Olingo macht?
public ClientEntity createEntity(URI absoluteUri,
ClientEntity ce) {
ODataEntityCreateRequest<ClientEntity> request = client
.getCUDRequestFactory().getEntityCreateRequest(absoluteUri, ce);
request.setAccept("application/json;odata.metadata=minimal");
ODataEntityCreateResponse<ClientEntity> response = request.execute();
return response.getBody();
}
Die Funktion getEntityCreateRequest
erzeugt jedoch nur eine POST
Anforderung und erlaubt (soweit ich weiß) keine Veränderung der verwendeten HttpMethod
.
Leider ist ODataEntityUpdateRequest
auch keine Option, da diese Anforderung nur die HttpMethod
PATCH
oder REPLACE
ermöglicht.
Innerhalb der Dokumentation habe ich eine Funktion setMethod(HttpMethod method)
gefunden, aber diese Methode ist nur für den Server nicht die Client-Implementierung (https://olingo.apache.org/javadoc/odata4/org/apache/olingo/server/api/ODataRequest.html).
Weiter entdeckte ich setUseXHTTPMethod(boolean value)
, die PUT, MERGE, PATCH, DELETE
über POST
tunnelt. Ich überprüfte die Konfiguration meines Clients, um sicherzustellen, dass false
ist, was es ist. (Referenz zu Funktionen: https://olingo.apache.org/javadoc/odata4/org/apache/olingo/client/api/Configuration.html)
Daher frage ich mich, wie man eine PUT
Anfrage mit Apache Olingo machen?
Vielen Dank für Ihre Eingabe.
Noch einmal, vielen Dank. Dies löst das Problem. :) –