Package com.google.api.client.http

Examples of com.google.api.client.http.EmptyContent


      HttpMethod method = request.getMethod();
      request.setMethod(HttpMethod.POST);
      request.getHeaders().set("X-HTTP-Method-Override", method.name());
      // Google servers will fail to process a POST unless the Content-Length header is specified
      if (request.getContent() == null) {
        request.setContent(new EmptyContent());
      }
    }
  }
View Full Code Here


      throws IOException {
    HttpRequest httpRequest = super.buildHttpRequest(method, url, body);
    new MethodOverride().intercept(httpRequest);
    // custom methods may use POST with no content but require a Content-Length header
    if (body == null && method.equals(HttpMethod.POST)) {
      httpRequest.setContent(new EmptyContent());
    }
    return httpRequest;
  }
View Full Code Here

   */
  private HttpResponse executeUploadInitiation(GenericUrl initiationRequestUrl) throws IOException {
    updateStateAndNotifyListener(UploadState.INITIATION_STARTED);

    initiationRequestUrl.put("uploadType", "resumable");
    HttpContent content = metadata == null ? new EmptyContent() : metadata;
    HttpRequest request =
        requestFactory.buildRequest(initiationMethod, initiationRequestUrl, content);
    addMethodOverride(request);
    initiationHeaders.setUploadContentType(mediaContent.getType());
    initiationHeaders.setUploadContentLength(getMediaContentLength());
View Full Code Here

  @Override
  public void clearCache(final String name) {
    try {

      final CacheResponse response = objectMapper.readValue(
          requestFactory.buildPostRequest(new ClearCacheUrl(hostName, projectId, name), new EmptyContent())
              .execute().getContent(), CacheResponse.class);

      validate(response, "cleared");

      log.debug("Successful request to clear to cache {}", name);
View Full Code Here

   */
  private HttpResponse executeUploadInitiation(GenericUrl initiationRequestUrl) throws IOException {
    updateStateAndNotifyListener(UploadState.INITIATION_STARTED);

    initiationRequestUrl.put("uploadType", "resumable");
    HttpContent content = metadata == null ? new EmptyContent() : metadata;
    HttpRequest request =
        requestFactory.buildRequest(initiationRequestMethod, initiationRequestUrl, content);
    initiationHeaders.set(CONTENT_TYPE_HEADER, mediaContent.getType());
    if (isMediaLengthKnown()) {
      initiationHeaders.set(CONTENT_LENGTH_HEADER, getMediaContentLength());
View Full Code Here

  @Beta
  void serverErrorCallback() throws IOException {
    Preconditions.checkNotNull(currentRequest, "The current request should not be null");

    // Query the current status of the upload by issuing an empty PUT request on the upload URI.
    currentRequest.setContent(new EmptyContent());
    currentRequest.getHeaders()
        .setContentRange("bytes */" + (isMediaLengthKnown() ? getMediaContentLength() : "*"));
  }
View Full Code Here

TOP

Related Classes of com.google.api.client.http.EmptyContent

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.