Package com.google.api.client.http

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


       *
       * @return the {@link com.google.api.services.fusiontables.model.Sqlresponse} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.fusiontables.model.Sqlresponse execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.fusiontables.model.Sqlresponse result = response.parseAs(
            com.google.api.services.fusiontables.model.Sqlresponse.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }
View Full Code Here


       *
       * @return the {@link com.google.api.services.fusiontables.model.Sqlresponse} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.fusiontables.model.Sqlresponse execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.fusiontables.model.Sqlresponse result = response.parseAs(
            com.google.api.services.fusiontables.model.Sqlresponse.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }
View Full Code Here

       *
       * @return the {@link com.google.api.services.fusiontables.model.Template} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.fusiontables.model.Template execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.fusiontables.model.Template result = response.parseAs(
            com.google.api.services.fusiontables.model.Template.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }
View Full Code Here

       *
       * @return the {@link com.google.api.services.fusiontables.model.Template} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.fusiontables.model.Template execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.fusiontables.model.Template result = response.parseAs(
            com.google.api.services.fusiontables.model.Template.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }
View Full Code Here

    }

    do {
      retryAllowed = retriesRemaining > 0;
      batchRequest.setContent(new MultipartMixedContent(requestInfos, "__END_OF_PART__"));
      HttpResponse response = batchRequest.execute();
      BatchUnparsedResponse batchResponse;
      try {
        // Find the boundary from the Content-Type header.
        String boundary = "--" + response.getMediaType().getParameter("boundary");

        // Parse the content stream.
        InputStream contentStream = response.getContent();
        batchResponse =
            new BatchUnparsedResponse(contentStream, boundary, requestInfos, retryAllowed);

        while (batchResponse.hasNext) {
          batchResponse.parseNextResponse();
        }
      } finally {
        response.disconnect();
      }

      List<RequestInfo<?, ?>> unsuccessfulRequestInfos = batchResponse.unsuccessfulRequestInfos;
      if (!unsuccessfulRequestInfos.isEmpty()) {
        requestInfos = unsuccessfulRequestInfos;
View Full Code Here

    if (directDownloadEnabled) {
      updateStateAndNotifyListener(DownloadState.MEDIA_IN_PROGRESS);

      HttpRequest request = requestFactory.buildGetRequest(requestUrl);
      HttpResponse response = request.execute();

      try {
        // All required bytes have been downloaded from the server.
        mediaContentLength = response.getHeaders().getContentLength();
        bytesDownloaded = mediaContentLength;
        updateStateAndNotifyListener(DownloadState.MEDIA_COMPLETE);
        AbstractInputStreamContent.copy(response.getContent(), outputStream);
      } finally {
        response.disconnect();
      }
      return;
    }

    // Download the media content in chunks.
    while (true) {
      HttpRequest request = requestFactory.buildGetRequest(requestUrl);
      request.getHeaders().setRange(
          "bytes=" + bytesDownloaded + "-" + (bytesDownloaded + chunkSize - 1));

      if (backOffPolicyEnabled) {
        // Set ExponentialBackOffPolicy as the BackOffPolicy of the HTTP Request which will
        // retry the same request again if there is a server error.
        request.setBackOffPolicy(new ExponentialBackOffPolicy());
      }

      HttpResponse response = request.execute();
      AbstractInputStreamContent.copy(response.getContent(), outputStream);

      String contentRange = response.getHeaders().getContentRange();
      long nextByteIndex = getNextByteIndex(contentRange);
      setMediaContentLength(contentRange);

      if (mediaContentLength <= nextByteIndex) {
        // All required bytes have been downloaded from the server.
View Full Code Here

       *
       * @return the {@link com.google.api.services.fusiontables.model.TemplateList} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.fusiontables.model.TemplateList execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.fusiontables.model.TemplateList result = response.parseAs(
            com.google.api.services.fusiontables.model.TemplateList.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }
View Full Code Here

       *
       * @return the {@link com.google.api.services.fusiontables.model.Template} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.fusiontables.model.Template execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.fusiontables.model.Template result = response.parseAs(
            com.google.api.services.fusiontables.model.Template.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }
View Full Code Here

       *
       * @return the {@link com.google.api.services.fusiontables.model.Template} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.fusiontables.model.Template execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.fusiontables.model.Template result = response.parseAs(
            com.google.api.services.fusiontables.model.Template.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }
View Full Code Here

       * Sends the "delete" request to the Fusiontables server.
       *
       * @throws IOException if the request fails
       */
      public void execute() throws IOException {
        HttpResponse response = executeUnparsed();
        response.ignore();
      }
View Full Code Here

TOP

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

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.