![](/img/trans.png)
[英]How to route all path to a single ServerResource with Restlet
[英]In Restlet, how can I get the Router instance from a ServerResource?
如何从ServerResource类访问应用程序的Router实例? 可能吗?
提前致谢。
当我问这个问题时,我不确定如何找不到答案……但这很简单。 在您的“ doInit”方法中,您可以执行以下操作:
Router myRouter = (Router)this.getApplication.getRoot();
很简单!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.