同一球衣REST API类的多个根路径
我有一个带有以下根路径的球衣REST API类
@Path(/v1/{start}/resource)
public class classA{
//Business logic
}
,现在我有一个要求,我需要还有一个指向同一REST类的路径,即有两个路径指向相同的REST类,例如:
两个端点/ V1/start/resource
和/start/resource
应击中上面给定的REST类。
有什么方法可以实现这一目标吗?
I have a Jersey REST API class with following root path
@Path(/v1/{start}/resource)
public class classA{
//Business logic
}
Now I have a requirement where I need to have one more path which points to same REST class, i.e have two paths pointing to same rest class, for example:
Both endpoints /v1/start/resource
and /start/resource
should hit the same above given rest class.
Is there any way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我在@path注释中使用regx找到了一个解决方案,如下所示:
“/{ver :( v1/)?} {start}/resource”
将解决两种> /v1/start/resource
或<代码>/start/resourceOkay, I found a solution for this using Regx in the @Path annotation as follows:
The
"/{ver : (v1/)?}{start}/resource"
will resolve to both/v1/start/resource
or/start/resource