Package com.google.api.client.http

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


    return httpRequest(method, needAccessToken).parseAs(responseType);
  }

  public <T extends IDoubanObject> int putResponseCodeOnly(String url, T requestObj, boolean needAccessToken) throws DoubanException, IOException {
    AtomContent content = AtomContent.forEntry(DefaultConfigs.DOUBAN_XML_NAMESPACE, requestObj);
    HttpRequest method = requestFactory.buildPutRequest(new GenericUrl(url), content);
    return httpRequest(method, needAccessToken).getStatusCode();
  }
View Full Code Here


    HttpRequest method = requestFactory.buildPutRequest(new GenericUrl(url), content);
    return httpRequest(method, needAccessToken).getStatusCode();
  }

  public int deleteResponse(String url, boolean needAccessToken) throws DoubanException, IOException {
    HttpRequest method = requestFactory.buildDeleteRequest(new GenericUrl(url));
    return httpRequest(method, needAccessToken).getStatusCode();
  }
View Full Code Here

      throw new IllegalArgumentException("Invalid scheme for " + this.getClass().getName());
    }

    HttpRequest request;
    try {
      request = netHttpTransport.createRequestFactory().buildGetRequest(new GenericUrl(uri));
      HttpResponse response = request.execute();
      if (response.getStatusCode() != HttpStatusCodes.STATUS_CODE_OK) {
        throw new RuntimeException("Invalid request: " + uri);
      }
View Full Code Here

    }

    HttpRequest request;
    try {
      destination.getParentFile().mkdirs();
      request = netHttpTransport.createRequestFactory().buildGetRequest(new GenericUrl(uri));
      HttpResponse response = request.execute();
      if (response.getStatusCode() != HttpStatusCodes.STATUS_CODE_OK) {
        throw new RuntimeException("Invalid request: " + uri);
      }
      final HttpHeaders headers = response.getHeaders();
View Full Code Here

  }

  private HttpRequest createRequest(String urlStr, Request fullQuery, String requestMethod,
      boolean useOAuth) throws GeneralSecurityException, IOException {
    Map<String, String> postData = fullQuery.getPostData();
    GenericUrl url = new GenericUrl(urlStr);
    if (debug) {
      fullQuery.printDebug();
      Logger logger = Logger.getLogger(HttpTransport.class.getName());
      logger.removeHandler(debugHandler);
      logger.setLevel(Level.ALL);
View Full Code Here

   }

   public static HttpRequest constructHttpRequest(final String method, final String targetUrl) throws IOException {

      return WEB_CLIENT.buildRequest(method,
         new GenericUrl(targetUrl),
         null);
   }
View Full Code Here

   }

   public static HttpRequest constructHttpRequest(final String method, final String targetUrl, final String content) throws IOException {

      return WEB_CLIENT.buildRequest(method,
         new GenericUrl(targetUrl),
         new ByteArrayContent(null, StringUtils.getBytesUtf8(content)));
   }
View Full Code Here

   * @deprecated (scheduled to removed in 1.8) Use
   *             {@link Builder#Builder(HttpTransport, JsonFactory, HttpRequestInitializer)}.
   */
   @Deprecated
   public static Builder builder(HttpTransport transport, JsonFactory jsonFactory) {
     return new Builder(transport, jsonFactory, new GenericUrl(DEFAULT_BASE_URL));
   }
View Full Code Here

   * @deprecated (scheduled to removed in 1.8) Use
   *             {@link Builder#Builder(HttpTransport, JsonFactory, HttpRequestInitializer)}.
   */
   @Deprecated
   public static Builder builder(HttpTransport transport, JsonFactory jsonFactory) {
     return new Builder(transport, jsonFactory, new GenericUrl(DEFAULT_BASE_URL));
   }
View Full Code Here

   *
   * @param authorizationCode authorization code.
   */
  public AuthorizationCodeTokenRequest newTokenRequest(String authorizationCode) {
    return new AuthorizationCodeTokenRequest(transport, jsonFactory,
        new GenericUrl(tokenServerEncodedUrl), authorizationCode).setClientAuthentication(
        clientAuthentication).setRequestInitializer(requestInitializer).setScopes(scopes);
  }
View Full Code Here

TOP

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

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.