Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpPatch


    @Override
    public <T> void patch(Edm edm, String resourcePath, Object data, Olingo2ResponseHandler<T> responseHandler) {
        final UriInfoImpl uriInfo = parseUri(edm, resourcePath, null);

        writeContent(edm, new HttpPatch(createUri(resourcePath, null)), uriInfo, data, responseHandler);
    }
View Full Code Here


        httpPost.setEntity(new StringEntity(body));
        return httpPost;
      }

      if (requestMethod.equals("PATCH")) {
        HttpPatch httpPatch = new HttpPatch(uri);
        httpPatch.setHeader("Accept", acceptType);
        httpPatch.setEntity(new StringEntity(body));
        return httpPatch;
      }

      if (requestMethod.equals("DELETE")) {
        HttpDelete httpDelete = new HttpDelete(uri);
View Full Code Here

    assertTrue(payload.contains("error"));
  }

  @Test
  public void patch() throws Exception {
    HttpPatch get = new HttpPatch(URI.create(getEndpoint().toString() + "aaa/bbb/ccc"));
    final HttpResponse response = getHttpClient().execute(get);

    assertEquals(HttpStatusCodes.NOT_FOUND.getStatusCode(), response.getStatusLine().getStatusCode());
    final String payload = StringHelper.inputStreamToString(response.getEntity().getContent());
    assertTrue(payload.contains("error"));
View Full Code Here

    HttpRequestBase request =
        httpMethod == ODataHttpMethod.GET ? new HttpGet() :
            httpMethod == ODataHttpMethod.DELETE ? new HttpDelete() :
                httpMethod == ODataHttpMethod.POST ? new HttpPost() :
                    httpMethod == ODataHttpMethod.PUT ? new HttpPut() : new HttpPatch();
    request.setURI(URI.create(getEndpoint() + uri));
    if (additionalHeader != null) {
      request.addHeader(additionalHeader, additionalHeaderValue);
    }
    if (requestBody != null) {
View Full Code Here

            } else if (method.equals(HTTPConstants.DELETE)) {
                httpRequest = new HttpDelete(uri);
            } else if (method.equals(HTTPConstants.GET)) {
                httpRequest = new HttpGet(uri);
            } else if (method.equals(HTTPConstants.PATCH)) {
                httpRequest = new HttpPatch(uri);
            } else {
                throw new IllegalArgumentException("Unexpected method: '"+method+"'");
            }
            setupRequest(url, httpRequest, res); // can throw IOException
        } catch (Exception e) {
View Full Code Here

            } else if (method.equals(HTTPConstants.DELETE)) {
                httpRequest = new HttpDelete(uri);
            } else if (method.equals(HTTPConstants.GET)) {
                httpRequest = new HttpGet(uri);
            } else if (method.equals(HTTPConstants.PATCH)) {
                httpRequest = new HttpPatch(uri);
            } else {
                throw new IllegalArgumentException("Unexpected method: '"+method+"'");
            }
            setupRequest(url, httpRequest, res); // can throw IOException
        } catch (Exception e) {
View Full Code Here

            } else if (method.equals(HTTPConstants.DELETE)) {
                httpRequest = new HttpDelete(uri);
            } else if (method.equals(HTTPConstants.GET)) {
                httpRequest = new HttpGet(uri);
            } else if (method.equals(HTTPConstants.PATCH)) {
                httpRequest = new HttpPatch(uri);
            } else {
                throw new IllegalArgumentException("Unexpected method: "+method);
            }
            setupRequest(url, httpRequest, res); // can throw IOException
        } catch (Exception e) {
View Full Code Here

      case PUT:
        return new HttpPut(uri);
      case TRACE:
        return new HttpTrace(uri);
      case PATCH:
        return new HttpPatch(uri);
      default:
        throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
    }
  }
View Full Code Here

   */
  @Override
  public <T> T patchEntity ( URL url, Map<String, String> paramMap, Class<T> clazz, Map<String, String> newHeaders )
      throws Exception
  {
    HttpPatch patch = new HttpPatch(url.toURI());
    setupMethod(patch, newHeaders);
    writeObject(paramMap, patch);
    return readObject(clazz, execute(patch));
  }
View Full Code Here

   * java.util.Map, java.util.Map)
   */
  @Override
  public void patch ( URL url, Map<String, String> paramMap, Map<String, String> newHeaders ) throws Exception
  {
    HttpPatch patch = new HttpPatch(url.toURI());
    setupMethod(patch, newHeaders);
    writeObject(paramMap, patch);
    HttpResponse response = execute(patch);
    EntityUtils.consumeQuietly(response.getEntity());
  }
View Full Code Here

TOP

Related Classes of org.apache.http.client.methods.HttpPatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.