The Facebook's platform supports three types of pagination using query string:
Cursor-based
- before - This is the cursor that points to the start of the page of data that has been returned.
- after - This is the cursor that points to the end of the page of data that has been returned.
- limit - This is the number of individual objects that are returned in each page.
Time-based
- until - A Unix timestamp or strtotime data value that points to the end of the range of time-based data.
- since - A Unix timestamp or strtotime data value that points to the start of the range of time-based data.
- limit - This is the number of individual objects that are returned in each page.
Offset-based
- offset - This offsets the start of each page by the number specified.
- limit - This is the number of individual objects that are returned in each page.
This example will stick to the Offset-based pagination, but you can choose the one that fits your requirements.
@GET @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") public List<Order> getOrders( @QueryParam("offset") Integer offset, @QueryParam("limit") Integer limit){ Query q = _em.createQuery("from Order"); if(offset != null){ q.setFirstResult(offset); } if(limit != null){ q.setMaxResults(limit); } return (List<Order>) q.getResultList(); }
The URL to access this would be:
/** * This URL would return the limit of 20 orders starting from order number 20. **/ http://www.ivanjunckes.com/resources/orders?offset=20&limit=20
The previous code shows a good path for doing pagination with REST and JAVA. However, there are some other ways of doing pagination, but this is a topic for another article.
See you later!
Source:
https://developers.facebook.com/docs/reference/api/pagination/
Great and Useful Article.
ReplyDeleteOnline Java Training | Java Training in Chennai | Java Training Institutes in Chennai | Online Java Course
Thanks a lot! You made a new blog entry to answer my question; I really appreciate your time and effort.
DeleteRESTful Web Services Corporate TRaining
RESTful Web Services Training In Chennai
Java Projects for Engineering Students of Computer Science
Project Centers in Chennai For CSE
Interesting Article
ReplyDeleteJava Web Services Training Online | Java Online Training
Java J2EE Online Training | Java Web Services Training in Chennai
Java Web Services Training in Chennai
Interesting Article
ReplyDeleteJava Web Services Training Online | Java Online Training
Java J2EE Online Training | Java Web Services Training in Chennai
Java Web Services Training in Chennai
Great Article
ReplyDeleteProject Centers in Chennai
Final Year Project Domains for CSE
JavaScript Training in Chennai
JavaScript Training in Chennai
The machine is then activated by means of a lever or button , which activates reels that spin and cease to rearrange the symbols. If a player matches a successful mixture of symbols, the player earns credit based on the paytable. Classic symbols embrace objects such as fruits, bells, and stylized fortunate sevens. Most slot video games have a theme, such as a particular aesthetic, location, or character. Symbols and other bonus features of the game are typically aligned with the theme. Some themes are licensed from well-liked media franchises, together with movies, tv series , entertainers, and 우리카지노 musicians.
ReplyDelete