Java Virtal Machine.net

[ News ] rss

February 01, 2011

Mark Wielaard: New GPG key. Finally created a new GPG key using gnupg. The old one was a DSA/1024 bits one and 8 years old. The new one is a RSA/2048 bits one. I will use the new one in the future to sign any release tarballs I might create. pub 2048R/57816A6A 2011-01-29 Key f...

More »

February 01, 2011

Andrew Hughes: [SECURITY] IcedTea6 1.7.8, 1.8.5, 1.9.5 Released!. We are pleased to announce a new set of security releases, IcedTea6 1.7.8, IcedTea6 1.8.5 and IcedTea6 1.9.5. This update contains the following security updates: The IcedTea project provides a harness to build the source code from OpenJDK6 u...

More »

December/2024
SunMonTueWedThuFriSat
1234567
891011121314
15161718192021
222324252627 28
293031    

[ Archives News
for 'Java Technology' ]

home > news > java technology > declarative http link headers

Declarative HTTP Link Headers

I've extended the declarative hyperlinking module to support the HTTP Link header. It works similarly to the @Link annotation I described earlier except you annotate the response entity class with @LinkHeader (or @LinkHeaders if you need more than one Link header) instead of annotating response entity fields with @Link. Here's a complete example that shows both annotations in action: @LinkHeader(value=@Link(resource=WidgetResource.class), rel="self") @XmlAccessorType(XmlAccessType.NONE) @XmlElement(name="widget") public class WidgetRepresentation { @Link(resource=WidgetResource.class) @XmlAttribute private String href; String id; public WidgetRepresentation(String id) { this.id = id; } public String getId() { return id; } } Given a resource class: @Path("widgets/{id}") public class WidgetResource { @GET @Produces("application/xml") WidgetRepresentation getWidget(@PathParam("id") String id) { return new WidgetRepresentation(id); } } A GET request for /application/widgets/10 will result in: HTTP/1.1 200 OK Server: GlassFish v3 Link: ;rel="self" Content-Type: application/xml Content-Length: xxx Date: Thu, 18 Mar 2010 21:04:04 GMT where the bold text is created by the new linking annotations.


Date: March, 18 2010
Url: http://www.java.net/blog/mhadley/archive/2010/03/18/declarative-http-link-headers


Others News

©2002-2019Java-Virtual-Machine.net it | fr | best website design software | formoid.com | css menu