繁体   English   中英

Restlet路由不适用于该路由中的Directory吗?

[英]Restlet routing does not work with Directory in the route?

使这些Restlet Server资源无法正常工作时,我有些麻烦:

  private static final String ROOT_URI = "/rest/";
  @Override
  public Restlet createInboundRoot() {
    Router router = new Router(getContext());
    Directory directory = new Directory(getContext(), "war:///doc");
    directory.setIndexName("app.html");
    router.attach(ROOT_URI + "files", GaeFilesServerResource.class);
    router.attach(ROOT_URI + "files/{file_id}", GaeFileServerResource.class);
    router.attach("/gwtapp/", directory); // This is the only one that works
    router.attach("/", RootServerResource.class);
    return router;
  }

如评论中所述,路由/ gwtapp /是唯一可行的路由。 访问http://localhost:8080/gwtapp/转发到http://localhost:8080/gwtapp/app.html是正确的。

问题是:

我想知道为什么//rest/下的那些在这种情况下不起作用?

解决方案是附加:

router.attachDefault(RootServerResource.class);

代替。

暂无
暂无

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

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