I would like to find a solution to use 2 routes for the same resource.
For instance, I am a resource CustomerResource and I would like to use this same resource for "/customer" and "/customer/" with a trailing slash added.
Do you have any suggestion about this ?
Regards,
EDIT: I override SpringBeanRouter to publish resource with and without trailing slash route:
public class MySpringBeanRouter extends SpringBeanRouter {
@Override
public TemplateRoute attach(String pathTemplate, Restlet target) {
if(pathTemplate != null && pathTemplate.endsWith("/"))
super.attach(pathTemplate.substring(0, pathTemplate.length() - 1), target);
return super.attach(pathTemplate, target);
}
}
It is possible to attach the same resource class under two different routes:
router.attach("/customer", CustomerServerResource.class);
router.attach("/customer/", CustomerServerResource.class);