diff options
Diffstat (limited to 'src/main/java/io/trygvis/esper/testing/nexus/NexusClient.java')
-rwxr-xr-x | src/main/java/io/trygvis/esper/testing/nexus/NexusClient.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/nexus/NexusClient.java b/src/main/java/io/trygvis/esper/testing/nexus/NexusClient.java index 02dc28c..9900bfc 100755 --- a/src/main/java/io/trygvis/esper/testing/nexus/NexusClient.java +++ b/src/main/java/io/trygvis/esper/testing/nexus/NexusClient.java @@ -30,13 +30,25 @@ public class NexusClient { this.xmlHttpClient = new XmlHttpClient(http); } - public NexusFeed fetchTimeline(String timeline) throws IOException { - URI uri = URI.create(nexusUrl.toASCIIString() + "/service/local/feeds/" + timeline); + public NexusFeed fetchTimeline(String timeline, int count, int from) throws IOException { + + String args = ""; + + if (count != 0) { + args += (args.length() == 0 ? "?" : "&") + "count=" + count; + } + + if (from != 0) { + args += (args.length() == 0 ? "?" : "&") + "from=" + from; + } + + System.out.println("args = " + args); + URI uri = URI.create(nexusUrl.toASCIIString() + "/service/local/feeds/" + timeline + args); Option<Document> d = xmlHttpClient.fetch(uri); if (d.isNone()) { - return new NexusFeed(Collections.<NexusEvent>emptyList()); + return new NexusFeed(Collections.<HasNexusEvent>emptyList()); } Document document = d.some(); |