Examples of HttpPatch


Examples of com.dg.libs.rest.entities.HttpPatch

        HttpPut putRequest = new HttpPut(getUrl() + generateParametersString(getParams()));
        putRequest.setEntity(entity);
        executeRequest(putRequest);
        break;
      case PATCH:
        HttpPatch patchRequest = new HttpPatch(getUrl() + generateParametersString(getParams()));
        patchRequest.setEntity(entity);
        executeRequest(patchRequest);
      default:
        throw new RuntimeException(
            "RequestMethod not supported, Only POST and PUT can contain body");
      }
View Full Code Here

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

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

        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

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

    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

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

    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

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

            } 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

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

            } 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

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

            } 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

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

      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

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

   */
  @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
TOP
Copyright © 2018 www.massapi.com. 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.