[aerogear-dev] Server Side: Paging API with Metadata and Links (was: Re: Paging Demo)

Daniel Bevenius daniel.bevenius at gmail.com
Tue Jan 22 12:25:48 EST 2013


We had a hangout and came up with the following suggestion. Please let us
know what you think and if there is something you are missing.

route()

      .from("/cars")

      .on(RequestMethod.GET)

      .produces(MediaType.JSON)

      .to(Cars.class).findCarsBy(param(PaginationInfo.class), param("color"));



@Paginated

public List<Car> findCarsBy(final PaginationInfo paginationInfo, final
String color) {

    return getCars(paginationInfo.getOffset(), color,
paginationInfo.getLimit());

}



@Qualifier

@Documented

@Retention(RetentionPolicy.RUNTIME)

@Target({ElementType.METHOD, ElementType.TYPE})

public @interface Paginated {

        String offsetParamName() default "offset";

    int defaultOffsetValue default 0;

        String limitParamName() default "limit";

    int defaultLimitValue default 0;



    String customHeadersPrefix() default "AG-";

}






On 22 January 2013 14:38, Daniel Bevenius <daniel.bevenius at gmail.com> wrote:

>
> +1 For keeping this on the Route configuration for M8. We can certainly
> change things later, I just feel that time is starting to run out, and I'd
> also need to add and test the Web Linking support.
>
>
> On 22 January 2013 14:22, Sebastien Blanc <scm.blanc at gmail.com> wrote:
>
>> +1
>>
>>
>> On Tue, Jan 22, 2013 at 2:22 PM, Douglas Campos <qmx at qmx.me> wrote:
>>
>>> On Tue, Jan 22, 2013 at 11:09:56AM -0200, Bruno Oliveira wrote:
>>> > I'm +1 for annotations or include it on Routes configuration.
>>> Since pagination != routing, annotation seems less intrusive, and
>>> there's the bonus point you can specify the limit/offset parameter names
>>> on that annotation.
>>>
>>> -- qmx
>>> _______________________________________________
>>> aerogear-dev mailing list
>>> aerogear-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>
>>
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> aerogear-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20130122/5fe7c5ac/attachment.html 


More information about the aerogear-dev mailing list