1

我在 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;

但是对于我的生活,我无法弄清楚是否有办法在其中添加查询参数。

如果有可能怎么办?如果不可能有任何建议来代替做什么?

4

1 回答 1

1

看起来它还不受支持:http: //java.net/jira/browse/JERSEY-688 1

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.
于 2013-01-18T08:08:13.370 回答