使这些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);


代替。

07-25 23:34
查看更多