Constructors Summary |
---|
public FacebookJsonRestClient(String apiKey, String secret)Constructor.
this(SERVER_URL, apiKey, secret, null);
|
public FacebookJsonRestClient(String apiKey, String secret, String sessionKey)Constructor.
this(SERVER_URL, apiKey, secret, sessionKey);
|
public FacebookJsonRestClient(String serverAddr, String apiKey, String secret, String sessionKey)Constructor.
this(new URL(serverAddr), apiKey, secret, sessionKey);
|
public FacebookJsonRestClient(URL serverUrl, String apiKey, String secret, String sessionKey)Constructor.
super(serverUrl, apiKey, secret, sessionKey);
|
Methods Summary |
---|
public java.lang.String | auth_getSession(java.lang.String authToken)Sets the session information (sessionKey) using the token from auth_createToken.
if (null != this._sessionKey) {
return this._sessionKey;
}
JSONObject d = (JSONObject)
this.callMethod(FacebookMethod.AUTH_GET_SESSION,
new Pair<String, CharSequence>("auth_token", authToken.toString()));
try {
this._sessionKey = (String) d.get("session_key");
Object uid = d.get("uid");
try {
this._userId = (Integer) uid;
} catch (ClassCastException cce) {
this._userId = Integer.parseInt((String) uid);
}
if (this.isDesktop()) {
this._sessionSecret = (String) d.get("secret");
}
}
catch (Exception ignored) {}
return this._sessionKey;
|
public java.lang.String | data_getUserPreference(java.lang.Integer prefId)
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. Please use an instance of FacebookRestClient instead.");
|
public java.util.Map | data_getUserPreferences()
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. Please use an instance of FacebookRestClient instead.");
|
public void | data_setUserPreference(java.lang.Integer prefId, java.lang.String value)
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. Please use an instance of FacebookRestClient instead.");
|
public void | data_setUserPreferences(java.util.Map values, boolean replace)
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. " +
"Please use an instance of FacebookRestClient instead.");
|
protected boolean | extractBoolean(java.lang.Object val)Extracts a Boolean from a result that consists of a Boolean only.
try {
return (Boolean) val;
} catch (ClassCastException cce) {
logException(cce);
return false;
}
|
protected int | extractInt(java.lang.Object val)Extracts an Integer from a result that consists of an Integer only.
try {
return (Integer) val;
} catch (ClassCastException cce) {
logException(cce);
return 0;
}
|
protected java.lang.Long | extractLong(java.lang.Object val)Extracts a Long from a result that consists of an Long only.
try {
return (Long) val;
} catch (ClassCastException cce) {
logException(cce);
return null;
}
|
public java.lang.String | extractString(java.lang.Object val)Extracts a String from a result consisting entirely of a String.
try {
return (String) val;
} catch (ClassCastException cce) {
logException(cce);
return null;
}
|
protected java.net.URL | extractURL(java.lang.Object url)Extracts a URL from a result that consists of a URL only.
For JSON, that result is simply a String.
if (!(url instanceof String)) {
return null;
}
return (null == url || "".equals(url)) ? null : new URL( (String) url);
|
public void | fbml_setRefHandle(java.lang.String handle, java.lang.String markup)
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. " +
"Please use an instance of FacebookRestClient instead.");
|
public java.lang.String | getResponseFormat()The response format in which results to FacebookMethod calls are returned
return "json";
|
public java.util.List | marketplace_getListings(java.util.List listingIds, java.util.List uids)
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. " +
"Please use an instance of FacebookRestClient instead.");
|
public java.util.List | marketplace_getSubCategories()
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. " +
"Please use an instance of FacebookRestClient instead.");
|
public java.util.List | marketplace_search(com.facebook.api.MarketListingCategory category, com.facebook.api.MarketListingSubcategory subcategory, java.lang.String searchTerm)
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. " +
"Please use an instance of FacebookRestClient instead.");
|
protected java.lang.Object | parseCallResult(java.io.InputStream data, com.facebook.api.IFacebookMethod method)Parses the result of an API call from JSON into Java Objects.
BufferedReader in = new BufferedReader(new InputStreamReader(data, "UTF-8"));
StringBuffer buffer = new StringBuffer();
String line;
while ((line = in.readLine()) != null) {
buffer.append(line);
}
String jsonResp = new String(buffer);
Object json = null;
try {
json = new JSONObject(jsonResp);
}
catch (Exception ignored) {}
if (isDebug()) {
log(method.methodName() + ": " + (null != json ? json.toString() : "null"));
}
if (json instanceof JSONObject) {
JSONObject jsonObj = (JSONObject) json;
try {
if (jsonObj.get("error_code") != null) {
Integer errorCode = (Integer) jsonObj.get("error_code");
String message = (String) jsonObj.get("error_msg");
throw new FacebookException(errorCode, message);
}
}
catch (JSONException e) {
throw new FacebookException(ErrorCode.GEN_UNKNOWN_ERROR, e.getClass().getName() + ": " + e.getMessage());
}
}
return json;
|
public boolean | sms_canSend()
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. " +
"Please use an instance of FacebookRestClient instead.");
|
public boolean | sms_canSend(java.lang.Long userId)
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. " +
"Please use an instance of FacebookRestClient instead.");
|
public java.lang.Integer | sms_send(java.lang.String message, java.lang.Integer smsSessionId, boolean makeNewSession)
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. " +
"Please use an instance of FacebookRestClient instead.");
|
public java.lang.Integer | sms_send(java.lang.Long userId, java.lang.String message, java.lang.Integer smsSessionId, boolean makeNewSession)
throw new FacebookException(ErrorCode.GEN_UNKNOWN_METHOD, "The FacebookJsonRestClient does not support this API call. " +
"Please use an instance of FacebookRestClient instead.");
|