meRef.addQueryParameter(OAuthServerResource.ACCESS_TOKEN,
accessToken);
ClientResource graphResource = new ClientResource(FB_GRAPH);
ClientResource meResource = graphResource.getChild(meRef);
JsonRepresentation meRepr = meResource
.get(JsonRepresentation.class);
if (meResource.getResponse().getStatus().isSuccess()) {
JSONObject me;
try {
me = meRepr.getJsonObject();
String id = me.get("id").toString();
log.info("Your ID = " + id);
accessTokens.put(id, accessToken);
// TODO Set Cookie
return true;
} catch (JSONException e) {
log.log(Level.WARNING, "Failed in parsing the me object.",
e);
}
}
meRepr.release();
meResource.release();
graphResource.release();
}
return false;