Apache CXF JAX/RS 调用中的 URL 重写
如何使用嵌入斜杠的路径参数进行 jax/rs 调用?
@DELETE
@Path("/extended/universal/{CID}")
@Produces( { XML, JSON })
public Response deleteCID( @PathParam("CID") String cId ) throws Exception
{
}
在这里,{CID} 包含一个字符串,有时为 - urn:cid:URI:http://example.com:80001/index.html
我已经没有想法了,拦截并重定向到更改的 URL 不是一个选项。如果 Apache CXF 为此类问题提供任何指南,请告诉我。
谢谢, 斯里坎特
How to make a jax/rs call with path params having slashes embedded in it?
@DELETE
@Path("/extended/universal/{CID}")
@Produces( { XML, JSON })
public Response deleteCID( @PathParam("CID") String cId ) throws Exception
{
}
Here, {CID} contains a string sometimes as - urn:cid:URI:http://example.com:80001/index.html
I am running out of ideas, Intercepting and redirecting to an altered URL is not an option. Please do let me know if Apache CXF provides any guidelines for such an issue.
Thanks,
Srikanth
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,路径组件不捕获斜杠。您可以通过显式提供说明片段应匹配内容的正则表达式来覆盖此设置。在您的情况下,请使用如下路径:
假设您不想匹配空的 CID。如果这样做,请将
+
更改为*
。By default, the path components don't capture slashes. You can override this by explicitly providing a regular expression that says what a fragment should match. In your case, use a path like this:
That's assuming you don't want to match an empty CID. If you do, change the
+
to a*
.