Package com.google.api.client.http

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


       * 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


      @Override
      public HttpResponse executeUnparsed() throws IOException {
        if (this.uploader == null) {
          return super.executeUnparsed();
        }
        HttpResponse response = uploader.upload(buildHttpRequestUrl());
        if (!response.isSuccessStatusCode()) {
          throw com.google.api.client.googleapis.json.GoogleJsonResponseException.from(
              getJsonFactory(), response);
        }
        return response;
      }
View Full Code Here

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

    StringBuilder partContent = new StringBuilder();
    while ((line = bufferedReader.readLine()) != null && !line.startsWith(boundary)) {
      partContent.append(line);
    }

    HttpResponse response =
        getFakeResponse(statusCode, partContent.toString(), headerNames, headerValues);

    parseAndCallback(requestInfos.get(contentId - 1), statusCode, contentId, response);

    checkForFinalBoundary(line);
View Full Code Here

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

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

    // make request
    HttpRequest request = requestFactory.buildPostRequest(
        tokenServerUrl, new UrlEncodedContent(this));
    request.setParser(new JsonObjectParser(jsonFactory));
    request.setThrowExceptionOnExecuteError(false);
    HttpResponse response = request.execute();
    if (response.isSuccessStatusCode()) {
      return response;
    }
    throw TokenResponseException.from(jsonFactory, response);
  }
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

    HttpRequest request =
        transport.createRequestFactory().buildPostRequest(url, new UrlEncodedContent(this));
    request.setParser(AuthKeyValueParser.INSTANCE);
    request.setContentLoggingLimit(0);
    request.setThrowExceptionOnExecuteError(false);
    HttpResponse response = request.execute();
    // check for an HTTP success response (2xx)
    if (response.isSuccessStatusCode()) {
      return response.parseAs(Response.class);
    }
    // On error, throw a ClientLoginResponseException with the parsed error details
    ErrorInfo details = response.parseAs(ErrorInfo.class);
    String detailString = details.toString();
    StringBuilder message = HttpResponseException.computeMessageBuffer(response);
    if (!com.google.common.base.Strings.isNullOrEmpty(detailString)) {
      message.append(StringUtils.LINE_SEPARATOR).append(detailString);
    }
View Full Code Here

    Preconditions.checkNotNull(jsonFactory);
    boolean originalThrowExceptionOnExecuteError = request.getThrowExceptionOnExecuteError();
    if (originalThrowExceptionOnExecuteError) {
      request.setThrowExceptionOnExecuteError(false);
    }
    HttpResponse response = request.execute();
    request.setThrowExceptionOnExecuteError(originalThrowExceptionOnExecuteError);
    if (!originalThrowExceptionOnExecuteError || response.isSuccessStatusCode()) {
      return response;
    }
    throw GoogleJsonResponseException.from(jsonFactory, response);
  }
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.