Java Code Examples for org.apache.olingo.commons.api.http.HttpMethod#PUT
The following examples show how to use
org.apache.olingo.commons.api.http.HttpMethod#PUT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CUDRequestFactoryImpl.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest( final URI targetURI, final ClientProperty property) { if (!property.hasPrimitiveValue()) { throw new IllegalArgumentException("A primitive value is required"); } final ODataPropertyUpdateRequest req; if (client.getConfiguration().isUseXHTTPMethod()) { req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.POST, targetURI, property); req.setXHTTPMethod(HttpMethod.PUT.name()); } else { req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.PUT, targetURI, property); } return req; }
Example 2
Source File: CUDRequestFactoryImpl.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest( final URI targetURI, final ClientProperty property) { if (!property.hasCollectionValue()) { throw new IllegalArgumentException("A collection value is required"); } final ODataPropertyUpdateRequest req; if (client.getConfiguration().isUseXHTTPMethod()) { req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.POST, targetURI, property); req.setXHTTPMethod(HttpMethod.PUT.name()); } else { req = new ODataPropertyUpdateRequestImpl(client, HttpMethod.PUT, targetURI, property); } return req; }
Example 3
Source File: BatchRequestParserTest.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Test public void batchBoundaryEqualsChangeSetBoundary() throws Exception { final String batch = "--" + BOUNDARY + CRLF + HttpHeader.CONTENT_TYPE + ": " + MULTIPART_MIXED + ";boundary=" + BOUNDARY + CRLF + CRLF + "--" + BOUNDARY + CRLF + MIME_HEADERS + HttpHeader.CONTENT_ID + ": 1" + CRLF + CRLF + HttpMethod.PUT + " " + PROPERTY_URI + HTTP_VERSION + CRLF + ACCEPT_HEADER + HttpHeader.CONTENT_TYPE + ": " + APPLICATION_JSON + CRLF + CRLF + "{\"value\":\"MODIFIED\"}" + CRLF + CRLF + "--" + BOUNDARY + "--" + CRLF + "--" + BOUNDARY + "--"; parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_BLANK_LINE); }
Example 4
Source File: CUDRequestFactoryImpl.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public ODataStreamUpdateRequest getStreamUpdateRequest(final URI targetURI, final InputStream stream) { final ODataStreamUpdateRequest req; if (client.getConfiguration().isUseXHTTPMethod()) { req = new ODataStreamUpdateRequestImpl(client, HttpMethod.POST, targetURI, stream); req.setXHTTPMethod(HttpMethod.PUT.name()); } else { req = new ODataStreamUpdateRequestImpl(client, HttpMethod.PUT, targetURI, stream); } return req; }
Example 5
Source File: CUDRequestFactoryImpl.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public ODataReferenceAddingRequest getReferenceSingleChangeRequest(final URI serviceRoot, final URI targetURI, final URI reference) { // See OData Protocol 11.4.6.3 final URI contextURI = client.newURIBuilder(serviceRoot.toASCIIString()).appendMetadataSegment().build(); ResWrap<URI> wrappedPayload = new ResWrap<>(contextURI, null, reference); return new ODataReferenceAddingRequestImpl(client, HttpMethod.PUT, targetURI, wrappedPayload); }
Example 6
Source File: BatchRequestParserTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Test public void noContentId() throws Exception { final String batch = "--" + BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.GET + " ESMedia" + HTTP_VERSION + CRLF + ACCEPT_HEADER + CRLF + CRLF + "--" + BOUNDARY + CRLF + HttpHeader.CONTENT_TYPE + ": " + MULTIPART_MIXED + "; boundary=" + CHANGESET_BOUNDARY + CRLF + CRLF + "--" + CHANGESET_BOUNDARY + CRLF + MIME_HEADERS + HttpHeader.CONTENT_ID + ": 1" + CRLF + CRLF + HttpMethod.POST + " ESMedia" + HTTP_VERSION + CRLF + HttpHeader.CONTENT_TYPE + ": image/png" + CRLF + "Content-Transfer-Encoding: base64" + CRLF + CRLF + "iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAIAAADtbgqsAAAABmJLR0QA/wD/AP+gvaeTAAAAH0lE" + "QVQokWNgGHmA8S4FmpkosXngNDP+PzdANg+cZgBqiQK5mkdWWgAAAABJRU5ErkJggg==" + CRLF + CRLF + "--" + CHANGESET_BOUNDARY + CRLF + MIME_HEADERS + HttpHeader.CONTENT_ID + ": 1" + CRLF + CRLF + HttpMethod.PUT + " $1/PropertyInt16" + HTTP_VERSION + CRLF + HttpHeader.CONTENT_TYPE + ": " + APPLICATION_JSON + CRLF + CRLF + "{\"value\":5}" + CRLF + "--" + CHANGESET_BOUNDARY + "--" + CRLF + CRLF + "--" + BOUNDARY + "--"; parse(batch); }
Example 7
Source File: ODataDispatcher.java From olingo-odata4 with Apache License 2.0 | 5 votes |
private void handleSingleEntityDispatching(final ODataRequest request, final ODataResponse response, final boolean isMedia, final boolean isSingleton) throws ContentNegotiatorException, ODataApplicationException, ODataLibraryException, ODataHandlerException, PreconditionException { final HttpMethod method = request.getMethod(); if (method == HttpMethod.GET) { validatePreferHeader(request); final ContentType requestedContentType = ContentNegotiator. doContentNegotiation(uriInfo.getFormatOption(), request, handler.getCustomContentTypeSupport(), RepresentationType.ENTITY); handler.selectProcessor(EntityProcessor.class) .readEntity(request, response, uriInfo, requestedContentType); } else if (method == HttpMethod.PUT || method == HttpMethod.PATCH) { if (isMedia) { validatePreferHeader(request); } validatePreconditions(request, false); final ContentType requestFormat = getSupportedContentType( request.getHeader(HttpHeader.CONTENT_TYPE), RepresentationType.ENTITY, true); final ContentType responseFormat = ContentNegotiator. doContentNegotiation(uriInfo.getFormatOption(), request, handler.getCustomContentTypeSupport(), RepresentationType.ENTITY); handler.selectProcessor(EntityProcessor.class) .updateEntity(request, response, uriInfo, requestFormat, responseFormat); } else if (method == HttpMethod.DELETE && !isSingleton) { validateIsSingleton(method); validatePreconditions(request, false); validatePreferHeader(request); if (isMedia) { ((MediaEntityProcessor) handler.selectProcessor(MediaEntityProcessor.class)) .deleteEntity(request, response, uriInfo); } else { ((EntityProcessor) handler.selectProcessor(EntityProcessor.class)) .deleteEntity(request, response, uriInfo); } } else { throwMethodNotAllowed(method); } }
Example 8
Source File: CUDRequestFactoryImpl.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public <E extends ClientEntity> ODataMediaEntityUpdateRequest<E> getMediaEntityUpdateRequest( final URI editURI, final InputStream media) { final ODataMediaEntityUpdateRequest<E> req; if (client.getConfiguration().isUseXHTTPMethod()) { req = new ODataMediaEntityUpdateRequestImpl<>(client, HttpMethod.POST, URIUtils.addValueSegment(editURI), media); req.setXHTTPMethod(HttpMethod.PUT.name()); } else { req = new ODataMediaEntityUpdateRequestImpl<>(client, HttpMethod.PUT, URIUtils.addValueSegment(editURI), media); } return req; }
Example 9
Source File: ODataDispatcher.java From olingo-odata4 with Apache License 2.0 | 5 votes |
private void handlePrimitiveValueDispatching(final ODataRequest request, final ODataResponse response, final UriResource resource) throws ContentNegotiatorException, ODataApplicationException, ODataLibraryException, ODataHandlerException, PreconditionException { final HttpMethod method = request.getMethod(); final EdmType type = resource instanceof UriResourceProperty ? ((UriResourceProperty) resource).getType() : ((UriResourceFunction) resource).getType(); final RepresentationType valueRepresentationType = type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary) ? RepresentationType.BINARY : RepresentationType.VALUE; if (method == HttpMethod.GET) { validatePreferHeader(request); final ContentType requestedContentType = ContentNegotiator. doContentNegotiation(uriInfo.getFormatOption(), request, handler.getCustomContentTypeSupport(), valueRepresentationType); handler.selectProcessor(PrimitiveValueProcessor.class) .readPrimitiveValue(request, response, uriInfo, requestedContentType); } else if (method == HttpMethod.PUT && resource instanceof UriResourceProperty) { validatePreconditions(request, false); final ContentType requestFormat = getSupportedContentType(request.getHeader(HttpHeader.CONTENT_TYPE), valueRepresentationType, true); final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(), request, handler.getCustomContentTypeSupport(), valueRepresentationType); handler.selectProcessor(PrimitiveValueProcessor.class) .updatePrimitiveValue(request, response, uriInfo, requestFormat, responseFormat); } else if (method == HttpMethod.DELETE && resource instanceof UriResourceProperty) { validatePreferHeader(request); validatePreconditions(request, false); handler.selectProcessor(PrimitiveValueProcessor.class) .deletePrimitiveValue(request, response, uriInfo); } else { throwMethodNotAllowed(method); } }
Example 10
Source File: BatchRequestParserTest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
@Test public void basic() throws Exception { final String batch = "--" + BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.GET + " " + PROPERTY_URI + "?$format=json" + HTTP_VERSION + CRLF + HttpHeader.ACCEPT_LANGUAGE + ":en-US,en;q=0.7,en-GB;q=0.9" + CRLF + CRLF + CRLF + "--" + BOUNDARY +CRLF + HttpHeader.CONTENT_TYPE + ": " + MULTIPART_MIXED + "; boundary=" + CHANGESET_BOUNDARY + CRLF + CRLF + "--" + CHANGESET_BOUNDARY + CRLF + MIME_HEADERS + HttpHeader.CONTENT_ID + ": changeRequest1" + CRLF + CRLF + HttpMethod.PUT + " " + PROPERTY_URI + HTTP_VERSION + CRLF + HttpHeader.CONTENT_LENGTH + ": 100000" + CRLF + ACCEPT_HEADER + HttpHeader.CONTENT_TYPE + ": " + APPLICATION_JSON + CRLF + CRLF + "{\"value\":\"€ MODIFIED\"}" + CRLF + CRLF + "--" + CHANGESET_BOUNDARY + "--" + CRLF + CRLF + "--" + BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.GET + " " + PROPERTY_URI + "?$format=json" + HTTP_VERSION + CRLF + CRLF + CRLF + "--" + BOUNDARY + "--"; final List<BatchRequestPart> batchRequestParts = parse(batch); Assert.assertNotNull(batchRequestParts); Assert.assertFalse(batchRequestParts.isEmpty()); for (final BatchRequestPart object : batchRequestParts) { Assert.assertEquals(1, object.getRequests().size()); final ODataRequest request = object.getRequests().get(0); Assert.assertEquals(SERVICE_ROOT, request.getRawBaseUri()); Assert.assertEquals("/" + PROPERTY_URI, request.getRawODataPath()); if (!object.isChangeSet()) { Assert.assertEquals(HttpMethod.GET, request.getMethod()); if (request.getHeaders(HttpHeader.ACCEPT_LANGUAGE) != null) { Assert.assertEquals(3, request.getHeaders(HttpHeader.ACCEPT_LANGUAGE).size()); } Assert.assertEquals(SERVICE_ROOT + "/" + PROPERTY_URI + "?$format=json", request.getRawRequestUri()); Assert.assertEquals("$format=json", request.getRawQueryPath()); } else { Assert.assertEquals(HttpMethod.PUT, request.getMethod()); Assert.assertEquals("100000", request.getHeader(HttpHeader.CONTENT_LENGTH)); Assert.assertEquals(APPLICATION_JSON, request.getHeader(HttpHeader.CONTENT_TYPE)); final List<String> acceptHeader = request.getHeaders(HttpHeader.ACCEPT); Assert.assertEquals(4, request.getHeaders(HttpHeader.ACCEPT).size()); Assert.assertEquals("application/atom+xml;q=0.8", acceptHeader.get(2)); Assert.assertEquals("*/*;q=0.1", acceptHeader.get(3)); Assert.assertEquals(SERVICE_ROOT + "/" + PROPERTY_URI, request.getRawRequestUri()); Assert.assertEquals("", request.getRawQueryPath()); // No query parameter Assert.assertEquals("{\"value\":\"€ MODIFIED\"}" + CRLF, IOUtils.toString(request.getBody())); } } }
Example 11
Source File: BatchRequestParserTest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
@Test public void methodsForIndividualRequests() throws Exception { final String batch = "--" + BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.POST + " ESAllPrim" + HTTP_VERSION + CRLF + HttpHeader.CONTENT_TYPE + ": " + APPLICATION_JSON + CRLF + CRLF + "{ \"PropertyString\": \"Foo\" }" + CRLF + "--" + BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.DELETE + " ESAllPrim(32767)" + HTTP_VERSION + CRLF + CRLF + CRLF + "--" + BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.PATCH + " ESAllPrim(32767)" + HTTP_VERSION + CRLF + HttpHeader.CONTENT_TYPE + ": " + APPLICATION_JSON + CRLF + CRLF + "{ \"PropertyString\": \"Foo\" }" + CRLF + "--" + BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.PUT + " ESAllPrim(32767)" + HTTP_VERSION + CRLF + HttpHeader.CONTENT_TYPE + ": " + APPLICATION_JSON + CRLF + CRLF + "{ \"PropertyString\": \"Foo\" }" + CRLF + "--" + BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.GET + " ESAllPrim(32767)" + HTTP_VERSION + CRLF + ACCEPT_HEADER + CRLF + CRLF + "--" + BOUNDARY + "--"; final List<BatchRequestPart> requests = parse(batch); Assert.assertEquals(HttpMethod.POST, requests.get(0).getRequests().get(0).getMethod()); Assert.assertEquals("/ESAllPrim", requests.get(0).getRequests().get(0).getRawODataPath()); Assert.assertEquals("{ \"PropertyString\": \"Foo\" }", IOUtils.toString(requests.get(0).getRequests().get(0).getBody())); Assert.assertEquals(HttpMethod.DELETE, requests.get(1).getRequests().get(0).getMethod()); Assert.assertEquals("/ESAllPrim(32767)", requests.get(1).getRequests().get(0).getRawODataPath()); Assert.assertEquals(HttpMethod.PATCH, requests.get(2).getRequests().get(0).getMethod()); Assert.assertEquals("/ESAllPrim(32767)", requests.get(2).getRequests().get(0).getRawODataPath()); Assert.assertEquals("{ \"PropertyString\": \"Foo\" }", IOUtils.toString(requests.get(2).getRequests().get(0).getBody())); Assert.assertEquals(HttpMethod.PUT, requests.get(3).getRequests().get(0).getMethod()); Assert.assertEquals("/ESAllPrim(32767)", requests.get(3).getRequests().get(0).getRawODataPath()); Assert.assertEquals("{ \"PropertyString\": \"Foo\" }", IOUtils.toString(requests.get(3).getRequests().get(0).getBody())); Assert.assertEquals(HttpMethod.GET, requests.get(4).getRequests().get(0).getMethod()); Assert.assertEquals("/ESAllPrim(32767)", requests.get(4).getRequests().get(0).getRawODataPath()); }
Example 12
Source File: BatchRequestParserTest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
@Test public void contentId() throws Exception { final String batch = "--" + BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.GET + " ESAllPrim" + HTTP_VERSION + CRLF + ACCEPT_HEADER + HttpHeader.CONTENT_ID + ": BBB" + CRLF + CRLF + CRLF + "--" + BOUNDARY + CRLF + HttpHeader.CONTENT_TYPE + ": " + MULTIPART_MIXED + "; boundary=" + CHANGESET_BOUNDARY + CRLF + CRLF + "--" + CHANGESET_BOUNDARY + CRLF + MIME_HEADERS + HttpHeader.CONTENT_ID + ": 1" + CRLF + CRLF + HttpMethod.POST + " ESMedia" + HTTP_VERSION + CRLF + HttpHeader.CONTENT_TYPE + ": image/png" + CRLF + "Content-Transfer-Encoding: base64" + CRLF + CRLF + "iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAIAAADtbgqsAAAABmJLR0QA/wD/AP+gvaeTAAAAH0lE" + "QVQokWNgGHmA8S4FmpkosXngNDP+PzdANg+cZgBqiQK5mkdWWgAAAABJRU5ErkJggg==" + CRLF + CRLF + "--" + CHANGESET_BOUNDARY + CRLF + MIME_HEADERS + CRLF + HttpMethod.PUT + " $1/PropertyInt16" + HTTP_VERSION + CRLF + HttpHeader.CONTENT_TYPE + ": " + APPLICATION_JSON + CRLF + HttpHeader.CONTENT_ID + ": 2" + CRLF + CRLF + "{\"value\":5}" + CRLF + "--" + CHANGESET_BOUNDARY + "--" + CRLF + CRLF + "--" + BOUNDARY + "--"; final List<BatchRequestPart> batchRequestParts = parse(batch); Assert.assertNotNull(batchRequestParts); for (BatchRequestPart multipart : batchRequestParts) { if (!multipart.isChangeSet()) { Assert.assertEquals(1, multipart.getRequests().size()); Assert.assertEquals("BBB", multipart.getRequests().get(0).getHeader(HttpHeader.CONTENT_ID)); } else { for (ODataRequest request : multipart.getRequests()) { if (HttpMethod.POST.equals(request.getMethod())) { Assert.assertEquals("1", request.getHeader(HttpHeader.CONTENT_ID)); } else if (HttpMethod.PUT.equals(request.getMethod())) { Assert.assertEquals("2", request.getHeader(HttpHeader.CONTENT_ID)); Assert.assertEquals("/$1/PropertyInt16", request.getRawODataPath()); Assert.assertEquals(SERVICE_ROOT + "/$1/PropertyInt16", request.getRawRequestUri()); } } } } }
Example 13
Source File: ODataDispatcher.java From olingo-odata4 with Apache License 2.0 | 4 votes |
private void handlePrimitiveDispatching(final ODataRequest request, final ODataResponse response, final boolean isCollection) throws ODataApplicationException, ODataLibraryException { final HttpMethod method = request.getMethod(); final RepresentationType representationType = isCollection ? RepresentationType.COLLECTION_PRIMITIVE : RepresentationType.PRIMITIVE; if (method == HttpMethod.GET) { validatePreferHeader(request); final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(), request, handler.getCustomContentTypeSupport(), representationType); if (isCollection) { handler.selectProcessor(PrimitiveCollectionProcessor.class) .readPrimitiveCollection(request, response, uriInfo, requestedContentType); } else { handler.selectProcessor(PrimitiveProcessor.class) .readPrimitive(request, response, uriInfo, requestedContentType); } } else if (method == HttpMethod.PUT || method == HttpMethod.PATCH) { validatePreconditions(request, false); ContentType requestFormat = null; List<UriResource> uriResources = uriInfo.getUriResourceParts(); UriResource uriResource = uriResources.get(uriResources.size() - 1); if (uriResource instanceof UriResourcePrimitiveProperty && ((UriResourcePrimitiveProperty)uriResource).getType() .getFullQualifiedName().getFullQualifiedNameAsString().equalsIgnoreCase(EDMSTREAM)) { requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE)); } else { requestFormat = getSupportedContentType(request.getHeader(HttpHeader.CONTENT_TYPE), representationType, true); } final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(), request, handler.getCustomContentTypeSupport(), representationType); if (isCollection) { handler.selectProcessor(PrimitiveCollectionProcessor.class) .updatePrimitiveCollection(request, response, uriInfo, requestFormat, responseFormat); } else { handler.selectProcessor(PrimitiveProcessor.class) .updatePrimitive(request, response, uriInfo, requestFormat, responseFormat); } } else if (method == HttpMethod.DELETE) { validatePreferHeader(request); validatePreconditions(request, false); if (isCollection) { handler.selectProcessor(PrimitiveCollectionProcessor.class) .deletePrimitiveCollection(request, response, uriInfo); } else { handler.selectProcessor(PrimitiveProcessor.class) .deletePrimitive(request, response, uriInfo); } } else { throwMethodNotAllowed(method); } }
Example 14
Source File: BatchRequestParserTest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
@Test public void epilog() throws Exception { String batch = "--" + BOUNDARY + CRLF + GET_REQUEST + "--" + BOUNDARY + CRLF + HttpHeader.CONTENT_TYPE + ": " + MULTIPART_MIXED + "; boundary=" + CHANGESET_BOUNDARY + CRLF + CRLF + "--" + CHANGESET_BOUNDARY + CRLF + MIME_HEADERS + HttpHeader.CONTENT_ID + ": 1" + CRLF + CRLF + HttpMethod.POST + " ESMedia" + HTTP_VERSION + CRLF + HttpHeader.CONTENT_TYPE + ": image/png" + CRLF + "Content-Transfer-Encoding: base64" + CRLF + CRLF + "iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAIAAADtbgqsAAAABmJLR0QA/wD/AP+gvaeTAAAAH0lE" + "QVQokWNgGHmA8S4FmpkosXngNDP+PzdANg+cZgBqiQK5mkdWWgAAAABJRU5ErkJggg==" + CRLF + CRLF + "--" + CHANGESET_BOUNDARY + CRLF + MIME_HEADERS + HttpHeader.CONTENT_ID + ": 2" + CRLF + CRLF + HttpMethod.PUT + " $1/PropertyInt16" + HTTP_VERSION + CRLF + HttpHeader.CONTENT_TYPE + ": " + APPLICATION_JSON + CRLF + CRLF + "{\"value\":5}" + CRLF + "--" + CHANGESET_BOUNDARY + "--" + CRLF + CRLF + "This is an epilog and must be ignored" + CRLF + CRLF + CRLF + "----1242" + CRLF + "--" + BOUNDARY + "--" + CRLF + "This is an epilog and must be ignored" + CRLF + CRLF + CRLF + "----1242"; final List<BatchRequestPart> batchRequestParts = parse(batch); Assert.assertNotNull(batchRequestParts); Assert.assertEquals(2, batchRequestParts.size()); BatchRequestPart getRequestPart = batchRequestParts.get(0); Assert.assertEquals(1, getRequestPart.getRequests().size()); ODataRequest getRequest = getRequestPart.getRequests().get(0); Assert.assertEquals(HttpMethod.GET, getRequest.getMethod()); BatchRequestPart changeSetPart = batchRequestParts.get(1); Assert.assertEquals(2, changeSetPart.getRequests().size()); Assert.assertEquals("iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAIAAADtbgqsAAAABmJLR0QA/wD/AP+gvaeTAAAAH0lE" + "QVQokWNgGHmA8S4FmpkosXngNDP+PzdANg+cZgBqiQK5mkdWWgAAAABJRU5ErkJggg==" + CRLF, IOUtils.toString(changeSetPart.getRequests().get(0).getBody())); Assert.assertEquals("{\"value\":5}", IOUtils.toString(changeSetPart.getRequests().get(1).getBody())); }
Example 15
Source File: ServiceRequest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
protected boolean isPUT() { return this.request.getMethod() == HttpMethod.PUT; }
Example 16
Source File: DataRequest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
@Override public HttpMethod[] allowedMethods() { return new HttpMethod[] { HttpMethod.GET, HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE }; }
Example 17
Source File: DataRequest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
@Override public HttpMethod[] allowedMethods() { return new HttpMethod[] { HttpMethod.GET, HttpMethod.PUT, HttpMethod.PATCH, HttpMethod.DELETE }; }
Example 18
Source File: DataRequest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
@Override public HttpMethod[] allowedMethods() { return new HttpMethod[] { HttpMethod.GET, HttpMethod.PUT, HttpMethod.DELETE }; }
Example 19
Source File: FunctionRequest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
@Override public HttpMethod[] allowedMethods() { return new HttpMethod[] { HttpMethod.GET, HttpMethod.POST, HttpMethod.PUT, HttpMethod.PATCH, HttpMethod.DELETE }; }
Example 20
Source File: MediaRequest.java From olingo-odata4 with Apache License 2.0 | 4 votes |
@Override public HttpMethod[] allowedMethods() { return new HttpMethod[] { HttpMethod.GET, HttpMethod.PUT, HttpMethod.DELETE }; }