简体   繁体   English

如何使用Restlet将所有路径路由到单个ServerResource

[英]How to route all path to a single ServerResource with Restlet

This code is a very basic Restlet app: 这段代码是一个非常基本的Restlet应用程序:

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? 我如何不仅将根“ / ”路由到RootServerResource ,还将所有“ /* ”路径路由? Is this a limitation of restlet or this can be done? 这是Restlet的限制还是可以做到的?

尝试:

  router.attachDefault(RootServerResource.class);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM