Spring Social Facebook | Get big photo from feedOperations -


when executing below code, getting small picture.

pagingparameters recordcount = new pagingparameters(2000, null, null, null); pagedlist<post> posts = facebook.feedoperations().getposts(recordcount); 

maven version:

<dependency <groupid>org.springframework.social</groupid> <artifactid>spring-social-facebook</artifactid> <version>2.0.3.release</version>  </dependency> 

how can full picture feed operation. there option this?

i analyze lots , posting solution question, since other can take this. return full picture part of data of post can fetch using post.getextradata().get("full_picture"). code snapshot below

public pagedlist<post> getpostbyaccountid(final string accountid) {     logger.debug("facebook accountid: ", accountid);     facebooktemplate facebook = new facebooktemplate("<access token>");      string[] all_post_fields = { "id", "actions", "admin_creator", "application", "caption", "created_time", "description", "from", "icon", "is_hidden", "is_published",             "link", "message", "message_tags", "name", "object_id", "picture", "full_picture", "place", "privacy", "properties", "source", "status_type", "story", "to",             "type", "updated_time", "with_tags", "shares" };      uribuilder uribuilder = uribuilder.fromuri(facebook.getbasegraphapiurl() + "me/posts");     uribuilder = uribuilder.queryparam("limit", string.valueof(2000));     uribuilder.queryparam("fields", org.springframework.util.stringutils.arraytocommadelimitedstring(all_post_fields));     uri uri = uribuilder.build();      jsonnode jsonnode = (jsonnode) facebook.getresttemplate().getforobject(uri, jsonnode.class);     pagedlist<post> posts = new deserializingposts().deserializelist(jsonnode, null, post.class);     return posts; } 

to fetch full_picture post.

string picture = post.getpicture();  picture = post.getextradata().get("full_picture") != null ? post.getextradata().get("full_picture").tostring() : picture; 

deserializingobject class details:

public class deserializingposts extends abstractoauth2apibinding {  private objectmapper objectmapper = new objectmapper();  /**  *   * @param jsonnode  * @param posttype  * @param type  * @return  */ public <t> pagedlist<t> deserializelist(jsonnode jsonnode, string posttype, class<t> type) {     jsonnode datanode = jsonnode.get("data");     list posts = new arraylist();     (iterator iterator = datanode.iterator(); iterator.hasnext();) {         posts.add(deserializepost(posttype, type, (objectnode) iterator.next()));     }     if (jsonnode.has("paging")) {         jsonnode pagingnode = jsonnode.get("paging");         pagingparameters previouspage = pagedlistutils.getpagedlistparameters(pagingnode, "previous");         pagingparameters nextpage = pagedlistutils.getpagedlistparameters(pagingnode, "next");         return new pagedlist(posts, previouspage, nextpage);     }      return new pagedlist(posts, null, null); }  /**  *   * @param posttype  * @param type  * @param node  * @return  */ public <t> t deserializepost(string posttype, class<t> type, objectnode node) {     try {         if (posttype == null) {             posttype = determineposttype(node);         }          node.put("posttype", posttype);         node.put("type", posttype);         mappingjackson2httpmessageconverter converter = super.getjsonmessageconverter();         this.objectmapper = new objectmapper();         this.objectmapper.registermodule(new facebookmodule());         converter.setobjectmapper(this.objectmapper);         return this.objectmapper.reader(type).readvalue(node.tostring());     } catch (ioexception shouldnthappen) {         throw new uncategorizedapiexception("facebook", "error deserializing " + posttype + " post", shouldnthappen);     } }  /**  *   * @param node  * @return  */ private string determineposttype(objectnode node) {     if (node.has("type")) {         try {             string type = node.get("type").textvalue();             post.posttype.valueof(type.touppercase());             return type;         } catch (illegalargumentexception e) {             return "post";         }     }     return "post"; } 

}


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -