【问题标题】:@Ref and @QueryParam@Ref 和 @QueryParam
【发布时间】:2013-01-18 16:08:13
【问题描述】:

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

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

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

【问题讨论】:

标签: jersey jax-rs java-ee-6


【解决方案1】:

目前似乎还不支持: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.

【讨论】:

    猜你喜欢
    • 2018-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-19
    • 1970-01-01
    • 2014-12-29
    • 1970-01-01
    相关资源
    最近更新 更多