RESTEasy




           Presented By,
           Khushbu M.
           Joshi
           Exam No.
Agenda
 Introduction
 What is REST? Why REST?
 Features of RESTEasy
 RESTEasy vs. Jersey
 Annotations
 Using Annotations
 Demonstration of Restful web service
  with RESTEasy
 References
Introduction
 Java API for RESTful Web Services
 Portable implementation that can run
  in any servlet container
 Jboss AS
 RESTEasy JAX-RS Client Framework
What is REST?
 REST Stands for REpresentational
  State Transfer.
 A concept, defined by Roy Fielding.
 Model each document and process as
  a resource (noun) with a unique URI.
  Everything has a unique URI.
Why REST?
 Scalable
 Human and machine usable
 Globally accessible resources
 Understandable URIs, resources, and
  actions.
Features
   Portable
   Client framework
   Rich set of providers
   GZIP content-encoding
   Rich interceptor model
   Security
   EJB, Spring integration
   Stateless
   Platform independence
   Lightweight
Features (cont.)
 Embedded container
 Client API
 Interceptor framework
 Data formats
 Component Integration
RESTEasy vs. Jersey
RESTEasy                 Jersey
Easier component         Harder component
integration              integration
easier for EJB 3.0 and   easier for Spring and JSON
SEAM integration         integration
Can be used with any     Can be used with Glassfish
application server       Application server
Can be used with any     Can be used with HTTP
protocol
Annotations
 @Path
 @ProduceMime, @ConsumeMime
 @GET, @POST, @DELETE, @PUT,
  @HEADER
 @PathParam
 @QueryParam
 @HeaderParam
 @CookieParam
 @MatrixParam
How to use them?
    Producer
 //Base URI path to resource
@Path(“/orders”)
public class OrderService {

     //Extension to Base URI that the method maps to
    @Path(“/{order-id}”)
     //HTTP method
    @GET
     // returned content type
    @ProduceMime(“application/xml”)
    String getOrder(@PathParam(“order-id”) int id) {
     …
    }
}
How to use them? (cont.)
   Consumer
@Path(“/orders”)
public class OrderService {

    @POST
      // expecting content type from client
    @ConsumeMime(“application/xml”)
    void submitOrder(String orderXml) {
     …
    }
}
Reference
   Book: JBoss_Enterprise_Web_Platform-5-
    RESTEasy_Reference_Guide-en-US
   http://www.packtpub.com/article/restful-web-service-
    implementation-with-
    resteasy?utm_source=rk_javarest_abr1_1109&utm_medium=
    content&utm_campaign=ramsai
   http://www.ibm.com/developerworks/
   http://www.h-online.com/open/news/item/RESTEasy-brings-
    REST-architecture-to-JBoss-739771.html
   http://my.safaribooksonline.com/book/programming/java/9781
    847196460/resteasy-jax-rs/ch07lvl1sec03
   https://community.jboss.org/wiki/RestEasyInJBossDeveloper
    StudioJBDSQuickstart
   Jboss.org
   http://technicalmumbojumbo.wordpress.com/2009/10/13/restf
    ul-webservices-using-jboss-resteasy-tutorial/

RESTEasy

  • 1.
    RESTEasy Presented By, Khushbu M. Joshi Exam No.
  • 2.
    Agenda  Introduction  Whatis REST? Why REST?  Features of RESTEasy  RESTEasy vs. Jersey  Annotations  Using Annotations  Demonstration of Restful web service with RESTEasy  References
  • 3.
    Introduction  Java APIfor RESTful Web Services  Portable implementation that can run in any servlet container  Jboss AS  RESTEasy JAX-RS Client Framework
  • 4.
    What is REST? REST Stands for REpresentational State Transfer.  A concept, defined by Roy Fielding.  Model each document and process as a resource (noun) with a unique URI. Everything has a unique URI.
  • 5.
    Why REST?  Scalable Human and machine usable  Globally accessible resources  Understandable URIs, resources, and actions.
  • 6.
    Features  Portable  Client framework  Rich set of providers  GZIP content-encoding  Rich interceptor model  Security  EJB, Spring integration  Stateless  Platform independence  Lightweight
  • 7.
    Features (cont.)  Embeddedcontainer  Client API  Interceptor framework  Data formats  Component Integration
  • 8.
    RESTEasy vs. Jersey RESTEasy Jersey Easier component Harder component integration integration easier for EJB 3.0 and easier for Spring and JSON SEAM integration integration Can be used with any Can be used with Glassfish application server Application server Can be used with any Can be used with HTTP protocol
  • 9.
    Annotations  @Path  @ProduceMime,@ConsumeMime  @GET, @POST, @DELETE, @PUT, @HEADER  @PathParam  @QueryParam  @HeaderParam  @CookieParam  @MatrixParam
  • 10.
    How to usethem?  Producer //Base URI path to resource @Path(“/orders”) public class OrderService { //Extension to Base URI that the method maps to @Path(“/{order-id}”) //HTTP method @GET // returned content type @ProduceMime(“application/xml”) String getOrder(@PathParam(“order-id”) int id) { … } }
  • 11.
    How to usethem? (cont.)  Consumer @Path(“/orders”) public class OrderService { @POST // expecting content type from client @ConsumeMime(“application/xml”) void submitOrder(String orderXml) { … } }
  • 12.
    Reference  Book: JBoss_Enterprise_Web_Platform-5- RESTEasy_Reference_Guide-en-US  http://www.packtpub.com/article/restful-web-service- implementation-with- resteasy?utm_source=rk_javarest_abr1_1109&utm_medium= content&utm_campaign=ramsai  http://www.ibm.com/developerworks/  http://www.h-online.com/open/news/item/RESTEasy-brings- REST-architecture-to-JBoss-739771.html  http://my.safaribooksonline.com/book/programming/java/9781 847196460/resteasy-jax-rs/ch07lvl1sec03  https://community.jboss.org/wiki/RestEasyInJBossDeveloper StudioJBDSQuickstart  Jboss.org  http://technicalmumbojumbo.wordpress.com/2009/10/13/restf ul-webservices-using-jboss-resteasy-tutorial/