Jersey and JAX-RS

6,089 views
5,953 views

Published on

A mini-overview of JAX-RS, the JCP standard for RESTful applications, and Jersery, its production-quality reference implementation

Published in: Technology, Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,089
On SlideShare
0
From Embeds
0
Number of Embeds
40
Actions
Shares
0
Downloads
106
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Jersey and JAX-RS

  1. 1. JAX-RS and Jersey Marc Hadley and Paul Sandoz Sun Microsystems
  2. 2. HEAD /JAX-RS ● Java API for RESTful Web Services ● Annotation-based server-side API ● Servlet or SE deployment ● 1.0 finalized end of September 2008 ● Online Spec and API ● 1.1 planned to integrate with new Java EE 6 features ● Five open source implementations already ● Jersey, JBoss RESTEasy, Restlet, Apache CXF, Triaxrs
  3. 3. GET /JAX-RS/Example @Path(quot;widgets/{id}quot;) @Produce(quot;application/widgets+xmlquot;) @Consumes(quot;application/widgets+xmlquot;) public class WidgetResource { private Widget w; public WidgetResource(@PathParam(quot;idquot;) String id) { this.w = locateRecord(id); } @GET Widget getWidget() { return w; } @PUT Widget updateWidget(Widget update) { w = processUpdate(update); return w; } }
  4. 4. HEAD /Jersey ● Open source production quality Reference Implementation ● https://jersey.dev.java.net/ ● http://wikis.sun.com/display/Jersey/Main ● 1.0 released in October ● Getting started ● Dependencies ● Overview of JAX-RS features ● Jersey API
  5. 5. GET /Glassfish/v3/Prelude
  6. 6. GET /NetBeans/6.5
  7. 7. GET /Samples ● Many samples are provided with the release ● Atom, JAXB, JSON, Scala, Spring, WADL, … ● Using GlassFish (+embedded) and Grizzly ● Download the 1.0 samples zip ● Samples are maven-based ● Works with NetBeans 6.x + maven plugin ● Individual sample zip file are also available – e.g. Sparklines, Mandel
  8. 8. GET /Involved ● Ask/answer questions, propose fixes/features ● mailto:users@jersey.dev.java.net http://markmail.org/search/?q=list%3Anet.java.dev.jersey.users
  9. 9. GET /Jersey/API ● Jersey client (API) ● Easier than HttpURLConnection! ● Reuses JAX-RS API ● Many samples contain tests using this API ● Spring 2.0.x or 2.5.x (Sample) ● XML configuration or Auto-wiring ● JSON with JAXB (API, Sample) ● MIME Multipart (in 1.0.1, API)

×