I am using Jersey 1.11.1 in GlassFish and I am trying to return a URI that has an @QueryParam.
For example I want the returned URI to look something like:
<bar>http://car.com/star?param=XYZ</bar>
I have the basic @Ref like this:
@Ref(
resource=Foo.class,
style = Ref.Style.ABSOLUTE,
bindings={}
)
@XmlElement
private URI bar;
but for the life of me I cannot figure out if there is a way to add the query param in there or not.
If it is possible how? If it isn't possible any suggestions on what to do instead?
Looks like it is not supported as of yet: 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.