Package com.google.appengine.api.urlfetch

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


    {
      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


    }
    URL url = new URL(strurl);
    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

    String authorization = generateAuthString(timestamp, nonce, sig);
    HTTPRequest request;
    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

   * @throws IOException
   * @see https://github.com/FanfouAPI/FanFouAPIDoc/wiki/statuses.update
   */
  public HTTPResponse statuses_reply(JID fromJID, String strMessage, String replyID) throws IOException,SocketTimeoutException
  {
    HTTPResponse response;
    response = statuses_show(fromJID, replyID);
    if(response.getResponseCode() == 200)
    {
      StatusJSON jsonStatus = new StatusJSON(new String(response.getContent()));
      String userid = jsonStatus.getUserJSON().getId();
      strMessage = "@" + jsonStatus.getUserJSON().getScreenName() + " " + strMessage;
      return statuses_update(fromJID, strMessage, replyID, userid, replyID);
    }
    else
    {
      Common.sendMessage(fromJID,"回复失败:" + Common.getError(new String(response.getContent())));
      Common.log.info(Common.getStrJID(fromJID) + "-r: " + Common.getError(new String(response.getContent())));
      return null;
    }
  }
View Full Code Here

   * @throws IOException
   * @see https://github.com/FanfouAPI/FanFouAPIDoc/wiki/statuses.update
   */
  public HTTPResponse statuses_repost(JID fromJID, String strMessage, String repostID) throws IOException,SocketTimeoutException
  {
    HTTPResponse response;
    response = statuses_show(fromJID, repostID);
    if(response.getResponseCode() == 200)
    {
      StatusJSON jsonStatus = new StatusJSON(new String(response.getContent()));
      String userid = jsonStatus.getUserJSON().getId();
      strMessage = strMessage + " 转@" + jsonStatus.getUserJSON().getScreenName()
          + " " + jsonStatus.getText();
      return statuses_update(fromJID, strMessage, repostID, userid, repostID);
    }
    else
    {
      Common.log.info(Common.getStrJID(fromJID) + "-rt: " + new String(response.getContent()));
      return null;
    }
  }
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

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

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

    String sig = generateSignature(params,oauth_token_secret);
    String authorization = generateAuthString(timestamp, nonce, sig);
    HTTPRequest 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

          + ",oauth_verifier=\"" + strPIN + "\"";

    HTTPRequest request = new HTTPRequest(url,HTTPMethod.GET);
    request.addHeader(new HTTPHeader("Authorization",authorization));
    URLFetchService service = URLFetchServiceFactory.getURLFetchService();
    HTTPResponse response = service.fetch(request);
   
    if(response.getResponseCode() == 200)
    {
      //继续执行
    }
    else if(response.getResponseCode() == 401)
    {
      Common.sendMessage(fromJID, "PIN码无效,请使用-oauth命令重新获取PIN码");
      Common.log.info(Common.getStrJID(fromJID) + " bind:" + new String(response.getContent()));
      return;
    }
    else
    {
      Common.sendMessage(fromJID,"未知错误,请重试");
      Common.log.info(Common.getStrJID(fromJID) + " bind:" + new String(response.getContent()));
      return;
    }
   
    /* 提取接收到的未经授权的Request Token */
    String tokenstring = new String(response.getContent());
    String[] tokenarr = tokenstring.split("&");
    String[] tokenarr2 = tokenarr[0].split("=");
    oauth_token = tokenarr2[1];
    tokenarr2 = tokenarr[1].split("=");
    String oauth_token_secret = tokenarr2[1];
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.