[英]In Restlet, how can I get the Router instance from a ServerResource?
How can I get access to the Application's Router instance from my ServerResource class? 如何从ServerResource类访问应用程序的Router实例? Is it even possible?
可能吗?
Thanks in advance. 提前致谢。
I'm not sure how I didn't find the answer to this when I asked the question... but it's pretty straightforward. 当我问这个问题时,我不确定如何找不到答案……但这很简单。 In your "doInit" method you can do something like this:
在您的“ doInit”方法中,您可以执行以下操作:
Router myRouter = (Router)this.getApplication.getRoot();
Very simple! 很简单!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.