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-";
}
+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@gmail.com> wrote:
+1On Tue, Jan 22, 2013 at 2:22 PM, Douglas Campos <qmx@qmx.me> wrote:
On Tue, Jan 22, 2013 at 11:09:56AM -0200, Bruno Oliveira wrote:Since pagination != routing, annotation seems less intrusive, and
> I'm +1 for annotations or include it on Routes configuration.
there's the bonus point you can specify the limit/offset parameter names
on that annotation.
-- qmx
_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev
_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev