abstact class AbstractPageRequestHandler() {
public List<Pair<String, String>> getPagingHeaders(ReadFilter filter){
List<Pair<String, String>> toReturn = new ArrayList<>();
return toReturn;
}
public byte[] appendToBody(ReadFilter filter, byte[] body){
return body;| public interface PagedResult<T> { | |
| PagedResult<T> next(); | |
| PagedResult<T> prev(); | |
| PagedResult<T> withOffset(int offset); | |
| PagedResult<T> withLimit(int limit); |
This document describes the client side interfaces which a developer can use to Query and Page through data obtained from remote rest services. This document describes both how to interact with the Aerogear-Controller based paging as well how to extend the libraries and APIs to support most other restful services. It is currently Java centric, but this should be fixed up in the future.
At a high level, Paging and Querying is supported though the Pipe.readWithFilter(ReadFilter, Callback) method. A ReadFilter object will set the current page, number of results perPage, and a where property. The Pipe implementation will be responsible for processing a request along with any paging data and sending the appropriate headers, data, and query parameters to the server. Once the response has been received, the Pipe implementation will provide a List of objects to the supplied callback. If this call used paging, the List will be an instance of PagedList.
PagedList will be a List of results f
//Smart use of enums
public enum DeviceComparator implements Comparator<Device> {
ID {
public int compare(Device o1, Device o2) {
return Integer.valueOf(o1.getId()).compareTo(o2.getId());
}},
NAME {
public int compare(Device o1, Device o2) {| NSDictionary *map = @{ @"key1": @"blah", @"key2": @"foo"}; |
| class apt-get::update { | |
| exec { "apt-get update": | |
| command => "apt-get update" | |
| } | |
| } |
| #!/usr/bin/env bash | |
| domain=$1 | |
| filename="/tmp/$(echo -n "$domain" | md5)" | |
| read -r -d '' screenrc <<SCREENRC | |
| startup_message off | |
| shell /usr/local/bin/bash | |
| autodetach on | |
| defscrollback 10000 |
This document is intended to discuss a solution for AEROGEAR-645 "Add Query/Paging support on RESTful endpoints".
This dev-aerogear mail list thread was used as a starting point to gather requirements and ideas.
Lets just clarify the two concepts that we are dealing with here, Paging and Query.
Paging deals with limiting the number of results returned from a single request. One "page" can contain a certain number of items as the result of invoking a request, sometimes referred to the size of a page. Let say you want to limit you the number of result returned to 10 items, this could look something like this:
Currently, when creating a new PipeConfig we use a constructor and specify a rootUrl:
URL rootUrl = new URL("http://todo-aerogear.rhcloud.com/todo-server");
Pipeline pipeline = new Pipeline(rootUrl);
PipeConfig config = new PipeConfig(rootUrl, Project.class);
Pipe<Project> projects = pipeline.pipe(Project.class, config);Currently, when creating a new PipeConfig we use a constructor and specify a rootUrl:
URL rootUrl = new URL("http://todo-aerogear.rhcloud.com/todo-server");
Pipeline pipeline = new Pipeline(rootUrl);
PipeConfig config = new PipeConfig(rootUrl, Project.class);
Pipe<Project> projects = pipeline.pipe(Project.class, config);