Package twitter4j

Examples of twitter4j.JSONObject$Null


      return false;
    return "retweet".equals(event);
  }

  public static DisconnectMessage parseDisconnectMessage(JSONObject message) throws JSONException {
    JSONObject json = message.getJSONObject("disconnect");
    int code = json.getInt("code");
    String streamName = json.getString("stream_name");
    String reason = json.getString("reason");
    return new DisconnectMessage(code, streamName, reason);
  }
View Full Code Here


    private String tokenType;

    private String accessToken;

    OAuth2Token(HttpResponse res) throws TwitterException {
        JSONObject json = res.asJSONObject();
        tokenType = getRawString("token_type", json);
        try {
            accessToken = URLDecoder.decode(getRawString("access_token", json), "UTF-8");
        } catch (UnsupportedEncodingException ignore) {
        }
View Full Code Here

            throw new TwitterException("Mobypic image upload returned invalid status code", httpResponse);

        String response = httpResponse.asString();

        try {
            JSONObject json = new JSONObject(response);
            if (!json.isNull("media")) {
                return json.getJSONObject("media").getString("mediaurl");
            }
        } catch (JSONException e) {
            throw new TwitterException("Invalid Mobypic response: " + response, e);
        }
View Full Code Here

            throw new TwitterException("ImgLy image upload returned invalid status code", httpResponse);

        String response = httpResponse.asString();

        try {
            JSONObject json = new JSONObject(response);
            if (!json.isNull("url"))
                return json.getString("url");
        } catch (JSONException e) {
            throw new TwitterException("Invalid ImgLy response: " + response, e);
        }

        throw new TwitterException("Unknown ImgLy response", httpResponse);
View Full Code Here

            throw new TwitterException("Twitpic image upload returned invalid status code", httpResponse);

        String response = httpResponse.asString();

        try {
            JSONObject json = new JSONObject(response);
            if (!json.isNull("url"))
                return json.getString("url");
        } catch (JSONException e) {
            throw new TwitterException("Invalid Twitpic response: " + response, e);
        }

        throw new TwitterException("Unknown Twitpic response", httpResponse);
View Full Code Here

    static final String limitJsonText = "{\"limit\":{\"track\":1234}}";

    static final String randomJsonText = "{\"random\":\"meaningless\"}";

    public void testDetermine() throws Exception {
        JSONObject json;

        json = new JSONObject(statusJsonText);
        if (JSONObjectType.determine(json) != JSONObjectType.Type.STATUS) {
            throw new Exception("JSONObjectType.determine failed for STATUS");
        }

        json = new JSONObject(deleteJsonText);
        if (JSONObjectType.determine(json) != JSONObjectType.Type.DELETE) {
            throw new Exception("JSONObjectType.determine failed for DELETE");
        }

        json = new JSONObject(scrubGeoJsonText);
        if (JSONObjectType.determine(json) != JSONObjectType.Type.SCRUB_GEO) {
            throw new Exception("JSONObjectType.determine failed for SCRUB_GEO");
        }

        json = new JSONObject(limitJsonText);
        if (JSONObjectType.determine(json) != JSONObjectType.Type.LIMIT) {
            throw new Exception("JSONObjectType.determine failed for LIMIT");
        }

        json = new JSONObject(randomJsonText);
        if (JSONObjectType.determine(json) != JSONObjectType.Type.UNKNOWN) {
            throw new Exception("JSONObjectType.determine failed for random");
        }

        String disconnectionNotice = "{\"disconnect\":{\"code\":3,\"stream_name\":\"yusuke-sitestream6139-yusuke\",\"reason\":\"control request for yusuke-sitestream6139 106.171.17.29 /1.1/site.json sitestream\"}}";
        json = new JSONObject(disconnectionNotice);
        if (JSONObjectType.determine(json) != JSONObjectType.Type.DISCONNECTION) {
            throw new Exception("JSONObjectType.determine failed for random");
        }

    }
View Full Code Here

TOP

Related Classes of twitter4j.JSONObject$Null

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.