[英]Adding Paths (routes) dynamically in resteasy
如何在resteasy(或jax-rs實現)中動態添加路由。現在,我使用@Path注釋添加路由。 例
@Controller
@Path("/api")
public class Controller {
@GET
@Path("/route1")
public String route1() {
return "Welcome ";
}
}
但是,我需要根據一些用戶輸入在運行時添加更多路由。 我的目標是根據用戶輸入在運行時創建rest api。
您需要將路徑寫為正則表達式。 這是本教程 。
所以它看起來像這樣:
@Controller
@Path("/api")
public class Controller {
@GET
@Path("/{subPath}")
public String subPath() {
return "Welcome ";
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.