我在GlassFish中使用Jersey 1.11.1,并试图返回一个带有@QueryParam的URI。
例如,我希望返回的URI如下所示:
<bar>http://car.com/star?param=XYZ</bar>我的基本@Ref是这样的:
@Ref(
resource=Foo.class,
style = Ref.Style.ABSOLUTE,
bindings={}
)
@XmlElement
private URI bar;但无论如何,我都不知道是否有一种方法可以在其中添加查询参数。
如果可能的话,怎么做呢?如果不可能,有什么建议可以替代吗?
发布于 2013-01-18 16:08:13
看起来目前还不支持:http://java.net/jira/browse/JERSEY-6881
The jersey-server-linking module lacks of support for query parameters.
Example:
@Ref(
value="books?page=${instance.page - 1}",
condition="${instance.page > 0}",
style=Style.ABSOLUTE
)
@XmlElement
URI previous;
The ? will be encoded as %3F. So it is not possible to add any query parameters to links generated by the @Ref annotation.https://stackoverflow.com/questions/14373135
复制相似问题