<div dir="ltr">No problems, I&#39;ll add the population of data to the demo.<div><br></div><div style>Thanks, </div><div style><br></div><div style>/Dan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 10 January 2013 11:54, Bruno Oliveira <span dir="ltr">&lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

                <div>
                    +1
                </div><span class="HOEnZb"><font color="#888888">
                <div><div><br></div><div><br></div><div><div>-- </div><div>&quot;The measure of a man is what he does with power&quot; - Plato</div><div>-</div><div>@abstractj</div><div>-</div><div>Volenti Nihil Difficile</div>
</div></div></font></span><div class="HOEnZb"><div class="h5">
                 
                <p style="color:#a0a0a8">On Thursday, January 10, 2013 at 8:02 AM, Matthias Wessendorf wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px">
                    <span><div><div><div>On Thu, Jan 10, 2013 at 10:11 AM, Daniel Bevenius</div><div>&lt;<a href="mailto:daniel.bevenius@gmail.com" target="_blank">daniel.bevenius@gmail.com</a>&gt; wrote:</div><blockquote type="cite">
<div><blockquote type="cite"><div><div>For the demo purpose, we could bootstrap the list of cars during startup so</div><div>we don&#39;t need to manually add all the cars.</div></div></blockquote><div>Absolutely, that would be no problem.</div>
</div></blockquote><div><br></div><div>+1 - that would make it easier to test/develop</div><div><br></div><blockquote type="cite"><div><div><br></div><div><br></div><div><br></div><div><br></div><div>On 10 January 2013 10:06, Sebastien Blanc &lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>&gt; wrote:</div>
<blockquote type="cite"><div><div><br></div><div>Great !</div><div>For the demo purpose, we could bootstrap the list of cars during startup</div><div>so we don&#39;t need to manually add all the cars.</div><div>Seb</div><div>
<br></div><div><br></div><div><br></div><div>On Thu, Jan 10, 2013 at 10:02 AM, Daniel Bevenius</div><div>&lt;<a href="mailto:daniel.bevenius@gmail.com" target="_blank">daniel.bevenius@gmail.com</a>&gt; wrote:</div><blockquote type="cite">
<div><div><br></div><div>We talked about paging yesterday on IRC, and it was decided to add a</div><div>paging example to aerogear-controller-demo. What follows is an example to</div><div>kick of further discussion about what the example should look like.</div>
<div><br></div><div>AeroGear Controller Demo Paging Route</div><div><br></div><div>This page discusses AEROGEAR-795 which is about adding an example to</div><div>aerogear-controller-demo to demonstrate paging support so that the client</div>
<div>libraries (Android, JavaScript, and iOS) can be tested against it.</div><div><br></div><div>This is only a suggestion and the implementation and the names of the</div><div>query parameters can all be changed.</div><div>
<br></div><div>Use case</div><div><br></div><div>The example is using cars as the resource to interact with. To be able to</div><div>query we need something to query, so lets start by adding some cars by</div><div>posting.</div>
<div><br></div><div>Adding Cars</div><div><br></div><div>URL=&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</div>
<div><br></div><div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Black&amp;car.brand=BMW&quot; -X</div><div>POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Red&amp;car.brand=Ferrari&quot;</div><div>-X POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Blue&amp;car.brand=Skoda&quot;</div><div>-X POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Green&amp;car.brand=Audi&quot;</div><div>-X POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Yello&amp;car.brand=Opel&quot;</div><div>-X POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Pink&amp;car.brand=Mini&quot; -X</div><div>POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Gray&amp;car.brand=Nissan&quot;</div><div>-X POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Red&amp;car.brand=Volvo&quot; -X</div><div>POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Blue&amp;car.brand=Saab&quot; -X</div><div>POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Black&amp;car.brand=Mazda&quot;</div><div>-X POST &quot;$URL/cars&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; -H &quot;Content-type:</div><div>application/x-www-form-urlencoded&quot; --data &quot;car.color=Yello&amp;car.brand=Golf&quot;</div><div>-X POST &quot;$URL/cars&quot;</div>
<div><br></div><div>The example uses an in-memory database so the data will be cleared upon</div><div>redployment/restart of the server. So you only need to populate/post when</div><div>you&#39;ve restared or redployed.</div>
<div><br></div><div>With the cars in place, we can now issue GET requests with paging query</div><div>parameters. The following route has been added to the demo:</div><div><br></div><div>route()</div><div>      .from(&quot;/cars&quot;)</div>
<div>      .on(RequestMethod.GET)</div><div>      .produces(MediaType.JSON.toString())</div><div>      .to(Cars.class).get(param(&quot;page&quot;, &quot;0&quot;), param(&quot;perPage&quot;, &quot;-1&quot;));</div><div><br>
</div><div>From this we can see that there are two optional parameters, page and</div><div>perPage. If these are not specified all cars will be returned.</div><div><br></div><div>Getting a page of Cars</div><div><br></div>
<div>URL=&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</div><div>curl -i --header &quot;Accept: application/json&quot; &quot;$URL/cars?page=0&amp;perPage=4&quot;</div>
<div><br></div><div>The request will return:</div><div><br></div><div>{</div><div>  &quot;metadata&quot;:{&quot;page&quot;:0,&quot;perPage&quot;:4},</div><div>  &quot;cars&quot;:[</div><div>            {&quot;color&quot;:&quot;Black&quot;,&quot;brand&quot;:&quot;BMW&quot;,&quot;id&quot;:1},</div>
<div>            {&quot;color&quot;:&quot;Red&quot;,&quot;brand&quot;:&quot;Ferrari&quot;,&quot;id&quot;:2},</div><div>            {&quot;color&quot;:&quot;Blue&quot;,&quot;brand&quot;:&quot;Skoda&quot;,&quot;id&quot;:3},</div>
<div>            {&quot;color&quot;:&quot;Green&quot;,&quot;brand&quot;:&quot;Audi&quot;,&quot;id&quot;:4}</div><div>          ],</div><div>  &quot;links&quot;:{</div><div>          &quot;first&quot;:&quot;cars?page=0&amp;page=4&quot;,</div>
<div>          &quot;previous&quot;:&quot;cars?page=0&amp;page=4&quot;,</div><div>          &quot;next&quot;:&quot;cars?page=1&amp;page=4&quot;</div><div>          }</div><div>}</div><div><br></div><div>Getting the next page of Cars</div>
<div><br></div><div>To get the next page you can follow the next link:</div><div><br></div><div>URL=&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; &quot;$URL/cars?page=1&amp;perPage=4&quot;</div><div><br></div><div>{</div><div>    &quot;metadata&quot;:{&quot;page&quot;:1,&quot;perPage&quot;:4},</div><div>    &quot;cars&quot;:[</div>
<div>            {&quot;color&quot;:&quot;Yello&quot;,&quot;brand&quot;:&quot;Opel&quot;,&quot;id&quot;:5},</div><div>            {&quot;color&quot;:&quot;Pink&quot;,&quot;brand&quot;:&quot;Mini&quot;,&quot;id&quot;:6},</div>
<div>            {&quot;color&quot;:&quot;Gray&quot;,&quot;brand&quot;:&quot;Nissan&quot;,&quot;id&quot;:7},</div><div>            {&quot;color&quot;:&quot;Red&quot;,&quot;brand&quot;:&quot;Volvo&quot;,&quot;id&quot;:8}</div>
<div>           ],</div><div>    &quot;links&quot;:{</div><div>            &quot;first&quot;:&quot;cars?page=0&amp;page=4&quot;,</div><div>            &quot;previous&quot;:&quot;cars?page=0&amp;page=4&quot;,</div><div>            &quot;next&quot;:&quot;cars?page=2&amp;page=4&quot;</div>
<div>            }</div><div>}</div><div><br></div><div>Get all Cars</div><div><br></div><div>URL=&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; &quot;$URL/cars&quot;</div><div><br></div><div>Get a single Car</div><div><br></div><div>URL=&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo" target="_blank">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo</a>&quot;</div>
<div>curl -i --header &quot;Accept: application/json&quot; &quot;$URL/cars/1&quot;</div><div><br></div><div>The request will return:</div><div><br></div><div>{&quot;color&quot;:&quot;Black&quot;,&quot;brand&quot;:&quot;BMW&quot;,&quot;id&quot;:1}</div>
<div><br></div><div>Again, anything here can be changed, the name of the query parameters,</div><div>the implementation, and what is returned.</div><div><br></div><div>Reference:</div><div><br></div><div>Paging Support in AeroGear Controller</div>
<div><br></div><div><br></div><div>_______________________________________________</div><div>aerogear-dev mailing list</div><div><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a></div>
<div><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></div></div></blockquote><div><br></div><div><br></div><div>_______________________________________________</div>
<div>aerogear-dev mailing list</div><div><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a></div><div><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></div>
</div></blockquote><div><br></div><div><br></div><div>_______________________________________________</div><div>aerogear-dev mailing list</div><div><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a></div>
<div><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></div></div></blockquote><div><br></div><div><br></div><div><br></div><div>-- </div>
<div>Matthias Wessendorf</div><div><br></div><div>blog: <a href="http://matthiaswessendorf.wordpress.com" target="_blank">http://matthiaswessendorf.wordpress.com</a>/</div><div>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a></div>
<div>twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a></div><div>_______________________________________________</div><div>aerogear-dev mailing list</div><div><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a></div>
<div><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>
            </div></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
<br></blockquote></div><br></div>