![](/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.