简体   繁体   English

如何使用RESTEasy制作自定义原子链接?

[英]How would I make custom atom links using RESTEasy?

I'm wondering if (and if so, how) it's possible to make RESTEasy return an object with custom atom links, such as links to next/previous page when paginating, particularly what I want to get is something akin to the following: 我想知道是否可以(如果这样,如何)使RESTEasy返回带有自定义原子链接的对象,例如在分页时指向下一页/上一页的链接,尤其是我想要得到的类似于以下内容:

<collection>
    <start>4</start>
    <values>4</values>
    <total>20</total>

    <item>...</item>
    <item>...</item>
    <item>...</item>
    <item>...</item>

    <atom:link rel="next" href="...?page=3"/>
    <atom:link rel="previous" href="...?page=1"/>
    <atom:link rel="first" href="...?page=1"/>
    <atom:link rel="last" href="...?page=5"/>
</collection>

I've worked out how to give links for discovery, but making custom links like this appears to be more complicated, if at all possible. 我已经解决了如何提供发现链接,但是,如果有可能的话,制作这样的自定义链接似乎更加复杂。

In the end I've ended up using the <any/> element and creating my own Elements to insert in to the any field of the JAXB objects. 最后,我最终使用了<any/>元素,并创建了自己的Elements来插入JAXB对象的any字段。 That seems to have its own problems , but at least it's a step further. 似乎有其自身的问题 ,但至少要更进一步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM