我正在构建一个JAX-RS 2.0 API,我正在尝试添加链接头。
links.add(Link.fromUri(firstUri.build()).rel("first").build());
Link.Builder last = Link.fromUri(lastUri.build()).rel("last");
links.add(last.build());
return Response
.ok(content)
.header("X-Total-Count", totalCount)
.links(links.toArray(new Link[] {}))
.build();
所以我得到的是:
HTTP/1.1 200 OK
X-Total-Count: 224
Link: <entities?limit=15&offset=70>;rel="next"
Link: <entities?limit=15&offset=40>;rel="prev"
Link: <entities?limit=15&offset=0>;rel="first"
Link: <entities?limit=15&offset=210>;rel="last"
Content-Type: application/json
但我想要的是:
HTTP/1.1 200 OK
X-Total-Count: 224
Link: <entities?limit=15&offset=70>;rel="next",<entities?limit=15&offset=40>;rel="prev",<entities?limit=15&offset=0>;rel="first",<entities?limit=15&offset=210>;rel="last"
Content-Type: application/json
那么,我做错了什么还是JAX-RS只是不理智?