[OLINGO-1315]OData v4.0:Client: API to return HTTP Request details
This commit is contained in:
parent
f344a3c565
commit
5b32c3acbf
|
@ -84,6 +84,7 @@ import org.apache.olingo.client.api.uri.FilterFactory;
|
|||
import org.apache.olingo.client.api.uri.URIBuilder;
|
||||
import org.apache.olingo.client.api.uri.URIFilter;
|
||||
import org.apache.olingo.client.core.ODataClientFactory;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
|
||||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.commons.api.edm.Edm;
|
||||
import org.apache.olingo.commons.api.edm.EdmActionImport;
|
||||
|
@ -538,7 +539,8 @@ public class BasicITCase extends AbstractParamTecSvcITCase {
|
|||
newEntity);
|
||||
assertNotNull(createRequest);
|
||||
final ODataEntityCreateResponse<ClientEntity> createResponse = createRequest.execute();
|
||||
|
||||
assertNotNull(createRequest.getHttpRequest());
|
||||
assertNotNull(((AbstractODataBasicRequest)createRequest).getPayload());
|
||||
assertEquals(HttpStatusCode.CREATED.getStatusCode(), createResponse.getStatusCode());
|
||||
assertEquals(SERVICE_URI + ES_ALL_PRIM + "(1)", createResponse.getHeader(HttpHeader.LOCATION).iterator().next());
|
||||
final ClientEntity createdEntity = createResponse.getBody();
|
||||
|
|
|
@ -81,7 +81,7 @@ public abstract class AbstractODataBasicRequest<T extends ODataResponse>
|
|||
*
|
||||
* @return InputStream for entire payload.
|
||||
*/
|
||||
protected abstract InputStream getPayload();
|
||||
public abstract InputStream getPayload();
|
||||
|
||||
/**
|
||||
* Serializes the full request into the given batch request.
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ODataDeleteRequestImpl extends AbstractODataBasicRequest<ODataDelet
|
|||
* No payload: null will be returned.
|
||||
*/
|
||||
@Override
|
||||
protected InputStream getPayload() {
|
||||
public InputStream getPayload() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ODataEntityCreateRequestImpl<E extends ClientEntity>
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InputStream getPayload() {
|
||||
public InputStream getPayload() {
|
||||
try {
|
||||
return odataClient.getWriter().writeEntity(entity, ContentType.parse(getContentType()));
|
||||
} catch (final ODataSerializerException e) {
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ODataEntityUpdateRequestImpl<E extends ClientEntity>
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InputStream getPayload() {
|
||||
public InputStream getPayload() {
|
||||
try {
|
||||
return odataClient.getWriter().writeEntity(changes, ContentType.parse(getContentType()));
|
||||
} catch (final ODataSerializerException e) {
|
||||
|
|
|
@ -84,7 +84,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InputStream getPayload() {
|
||||
public InputStream getPayload() {
|
||||
try {
|
||||
return odataClient.getWriter().writeProperty(property, ContentType.parse(getContentType()));
|
||||
} catch (final ODataSerializerException e) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ODataReferenceAddingRequestImpl extends AbstractODataBasicRequest<O
|
|||
* No payload: null will be returned.
|
||||
*/
|
||||
@Override
|
||||
protected InputStream getPayload() {
|
||||
public InputStream getPayload() {
|
||||
if (reference == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
|
|
@ -85,7 +85,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
|
|||
* {@inheritDoc }
|
||||
*/
|
||||
@Override
|
||||
protected InputStream getPayload() {
|
||||
public InputStream getPayload() {
|
||||
return IOUtils.toInputStream(value.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public abstract class AbstractODataInvokeRequest<T extends ClientInvokeResult>
|
|||
protected abstract ContentType getPOSTParameterFormat();
|
||||
|
||||
@Override
|
||||
protected InputStream getPayload() {
|
||||
public InputStream getPayload() {
|
||||
if (!this.parameters.isEmpty() && this.method == HttpMethod.POST) {
|
||||
// Additional, non-binding parameters MUST be sent as JSON
|
||||
final ClientEntity tmp = odataClient.getObjectFactory().newEntity(null);
|
||||
|
|
|
@ -54,7 +54,7 @@ public abstract class AbstractODataRetrieveRequest<T>
|
|||
* This kind of request doesn't have any payload: null will be returned.
|
||||
*/
|
||||
@Override
|
||||
protected InputStream getPayload() {
|
||||
public InputStream getPayload() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ public abstract class AbstractODataResponse implements ODataResponse {
|
|||
throw new NoContentException();
|
||||
}
|
||||
|
||||
if (payload == null && batchInfo.isValidBatch()) {
|
||||
if (payload == null && batchInfo != null && batchInfo.isValidBatch()) {
|
||||
// get input stream till the end of item
|
||||
payload = new PipedInputStream();
|
||||
|
||||
|
|
Loading…
Reference in New Issue