Package com.google.api.client.http

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


        GoogleTokenResponse tokenData = accessTokenContext.getTokenData();
        try {
            return invokeRequest(accessTokenContext);
        } catch (IOException ioe) {
            if (ioe instanceof HttpResponseException) {
                HttpResponseException googleException = (HttpResponseException)ioe;
                if (googleException.getStatusCode() == 400 && tokenData.getRefreshToken() != null) {
                    try {
                        // Refresh token and retry revocation with refreshed token
                        googleProcessor.refreshToken(accessTokenContext);
                        return invokeRequest(accessTokenContext);
                    } catch (OAuthException refreshException) {
View Full Code Here


        .setApplicationName("bla").build();
    HttpRequest request = storage.objects().delete("b", "o").buildHttpRequest();
    request.getHeaders().clear();
    request.getHeaders().put("k1", "v1");
    request.getHeaders().put("k2", "v2");
    HttpResponseException exception = null;
    try {
      request.execute();
    } catch (HttpResponseException ex) {
      exception = ex;
    }
View Full Code Here

    try {
      credentials = oAuthProviderHelp.exchangeCodeForToken(split[0], code);
    } catch (IOException e) {
      log.log(Level.WARNING, "Failed attempt, trying again", e);
      if (e instanceof HttpResponseException) {
        HttpResponseException f = (HttpResponseException) e;
        ByteArrayOutputStream o = new ByteArrayOutputStream();
        f.getResponse().getRequest().getContent().writeTo(o);
        // TODO(ohler): Use correct character set.
        log.warning("content of rejected request: " + o.toString());
        log.warning("rejection response body: " + f.getResponse().parseAsString());
      }
      resp.sendRedirect(req.getRequestURI() + "?code=" + urlEncode(code) + "&state="
          + urlEncode(state) + "&tryagain=true");
      return;
    }
View Full Code Here

    try {
      authResponse = authRequest.execute();
    } catch (IOException e) {
      log.log(Level.WARNING, "Failed attempt, trying again", e);
      if (e instanceof HttpResponseException) {
        HttpResponseException f = (HttpResponseException) e;
        ByteArrayOutputStream o = new ByteArrayOutputStream();
        f.getResponse().getRequest().getContent().writeTo(o);
        // TODO(ohler): Use correct character set.
        log.warning("content of rejected request: " + o.toString());
        log.warning("rejection response body: " + f.getResponse().parseAsString());
      }
      resp.sendRedirect(req.getRequestURI() + "?code=" + urlEncode(code) + "&tryagain=true");
      return;
    }
    String refreshToken = authResponse.refreshToken;
View Full Code Here

TOP

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

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.