Search code examples
javarestletrestlet-2.0

How to route all path to a single ServerResource with Restlet


This code is a very basic Restlet app:

public class FirstStepsApplication extends Application {
  private static final String ROOT_URI = "/";
  @Override
  public Restlet createInboundRoot() {
    Router router = new Router(getContext());
    router.attach(ROOT_URI, RootServerResource.class);
    return router;
  }
}

How can I route not just root "/" into the RootServerResource but also all "/*" path? Is this a limitation of restlet or this can be done?


Solution

  • Try:

      router.attachDefault(RootServerResource.class);