JAX-RS and Jersey




Marc Hadley and Paul Sandoz
     Sun Microsystems
HEAD /JAX-RS
●   Java API for RESTful Web Services
    ●   Annotation-based server-side API
    ●   Servlet or SE deployme...
GET /JAX-RS/Example
@Path(quot;widgets/{id}quot;)
@Produce(quot;application/widgets+xmlquot;)
@Consumes(quot;application/w...
HEAD /Jersey
●   Open source production quality Reference
    Implementation
    ●   https://jersey.dev.java.net/
    ●   ...
GET /Glassfish/v3/Prelude
GET /NetBeans/6.5
GET /Samples
●   Many samples are provided with the release
    ●   Atom, JAXB, JSON, Scala, Spring, WADL, …
    ●   Using...
GET /Involved
●   Ask/answer questions, propose fixes/features
    ●   mailto:users@jersey.dev.java.net




        http:/...
GET /Jersey/API
●   Jersey client (API)
    ●   Easier than HttpURLConnection!
    ●   Reuses JAX-RS API
    ●   Many samp...
Upcoming SlideShare
Loading in …5
×

Jersey and JAX-RS

6,397 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
  • Be the first to comment

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)

×