Package com.google.appengine.api.urlfetch

Examples of com.google.appengine.api.urlfetch.HTTPResponse


    @Test
    public void testFailureNoException() throws Exception {
        GHttpEndpoint endpoint = createEndpoint(getBaseUri("ghttp") + "/test?throwExceptionOnFailure=false");
        HTTPRequest request = new HTTPRequest(endpoint.getEndpointUrl());
        request.addHeader(new HTTPHeader("code", "500"));
        HTTPResponse response = service.fetch(request);
        binding.readResponse(endpoint, exchange, response);
        assertEquals(500, exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
    }
View Full Code Here


    Entity account = new Entity("Account",strJID);
    account.setProperty("access_token", oauth_token);
    account.setProperty("access_token_secret",oauth_token_secret);
   
    API api = new API(oauth_token,oauth_token_secret);
    HTTPResponse response = api.account_verify_credentials(fromJID);
    String id = null;
    if(response.getResponseCode() == 200)
    {
      try {
        JSONObject respJSON = new JSONObject(new String(response.getContent()));
        id = respJSON.getString("id");
      } catch (JSONException e) {
        Common.log.warning(strJID + ":JSONid " + e.getMessage());
      }
    }
   
    if(id == null)
    {
      datastore.put(account);
      Common.sendMessage(fromJID,"成功绑定,但在获取饭否ID时出现未知错误");
      Common.log.warning(strJID + ": " + new String(response.getContent()));
    }
    else
    {
      account.setProperty("id", id);
      datastore.put(account);
View Full Code Here

    API api = Common.getAPI(fromJID);
    if(api == null)
    {
      return;
    }
    HTTPResponse response = api.statuses_mentions(fromJID, null, last_mention_id);
    Common.StatusShowResp(fromJID, response,3);
  }
View Full Code Here

    String sig = generateSignature(params,oauth_token_secret);
    String authorization = generateAuthString(timestamp, nonce, sig);
    HTTPRequest request = new HTTPRequest(url,HTTPMethod.GET);
    request.addHeader(new HTTPHeader("Authorization",authorization));
    URLFetchService service = URLFetchServiceFactory.getURLFetchService();
    HTTPResponse response = service.fetch(request);
    return response;
  }
View Full Code Here

    {
      request = new HTTPRequest(new URL(url.toString() + "?page=" + pageID),HTTPMethod.GET);
    }
    request.addHeader(new HTTPHeader("Authorization",authorization));
    URLFetchService service = URLFetchServiceFactory.getURLFetchService();
    HTTPResponse response = service.fetch(request);
    return response;
  }
View Full Code Here

    request.addHeader(new HTTPHeader("Content-Type","application/x-www-form-urlencoded"));

    String strPayload = "id=" + id;
    request.setPayload(strPayload.getBytes());
    URLFetchService service = URLFetchServiceFactory.getURLFetchService();
    HTTPResponse response = service.fetch(request);
   
    return response;
  }
View Full Code Here

    request.addHeader(new HTTPHeader("Content-Type","application/x-www-form-urlencoded"));
   
    String strPayload = "id=" + id;
    request.setPayload(strPayload.getBytes());
    URLFetchService service = URLFetchServiceFactory.getURLFetchService();
    HTTPResponse response = service.fetch(request);
   
    return response;
  }
View Full Code Here

    String authorization = generateAuthString(timestamp, nonce, sig);
    HTTPRequest request;
    request = new HTTPRequest(new URL(strURL + "?q=" + URLEncoder.encode(query_word,"UTF-8")),HTTPMethod.GET);
    request.addHeader(new HTTPHeader("Authorization",authorization));
    URLFetchService service = URLFetchServiceFactory.getURLFetchService();
    HTTPResponse response = service.fetch(request);
    return response;
  }
View Full Code Here

    String authorization = generateAuthString(timestamp, nonce, sig);
    HTTPRequest request;
    request = new HTTPRequest(new URL(url.toString() + "?id=" + id),HTTPMethod.GET);
    request.addHeader(new HTTPHeader("Authorization",authorization));
    URLFetchService service = URLFetchServiceFactory.getURLFetchService();
    HTTPResponse response = service.fetch(request);
    return response;
  }
View Full Code Here

    request.addHeader(new HTTPHeader("Content-Type","application/x-www-form-urlencoded"));
   
    String strPayload = "id=" + id;
    request.setPayload(strPayload.getBytes());
    URLFetchService service = URLFetchServiceFactory.getURLFetchService();
    HTTPResponse response = service.fetch(request);
   
    return response;
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.urlfetch.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.