SlideShare a Scribd company logo
1 of 48
Download to read offline
<Insert Picture Here>




Developing RESTful Web services with JAX-RS
Arun Gupta, Java EE & GlassFish Guy
blogs.sun.com/arungupta, @arungupta
The following/preceding is intended to outline our
general product direction. It is intended for
information purposes only, and may not be
incorporated into any contract. It is not a
commitment to deliver any material, code, or
functionality, and should not be relied upon in
making purchasing decisions.
The development, release, and timing of any
features or functionality described for Oracle’s
products remains at the sole discretion of Oracle.



                                                     2
REST is an Architectural Style




   Style of software architecture for
distributed hypermedia systems such
          as World Wide Web



                                        3
RESTful Web Services



Application of REST architectural style
 to services that utilize Web standards
(URIs, HTTP, HTML, XML, Atom, RDF
                   etc.)


                                          4
Java API for RESTful Web Services
(JAX-RS)


 Standard annotation-driven API that
aims to help developers build RESTful
        Web services in Java



                                        5
RESTful Application Cycle

            Resources are identified by URIs
                             ↓
 Clients communicate with resources via requests using a
                 standard set of methods
                             ↓
Requests and responses contain resource representations in
            formats identified by media types
                             ↓
   Responses contain URIs that link to further resources




                                                             6
Principles of REST

• Give everything an ID
• Standard set of methods
• Link things together
• Multiple representations
• Stateless communications




                             7
Give Everything an ID

• ID is a URI

 http://example.com/widgets/foo

 http://example.com/customers/bar

 http://example.com/customers/bar/orders/2

 http://example.com/orders/101230/customer




                                             8
Resources are identified by URIs

http://example.com/widgets/foo

http://example.com/customers/bar

http://example.com/customers/bar/orders/2

http://example.com/orders/101230/customer




                                            9
Resources are identified by URIs

• Resource == Java class
 • POJO
 • No required interfaces
• ID provided by @Path annotation
 • Value is relative URI, base URI is provided by deployment
   context or parent resource
 • Embedded parameters for non-fixed parts of the URI
 • Annotate class or “sub-resource locator” method




                                                               10
Resources are identified by URIs

@Path("orders/{order_id}")
public class OrderResource {

    @GET
    @Path("customer")
    CustomerResource getCustomer(...) {...}
}




                                              11
Standard Set of Methods


    Method                    Purpose

   GET       Read, possibly cached

   POST      Update or create without a known ID

   PUT       Update or create with a known ID

   DELETE    Remove




                                                   12
Standard Set of Methods

• Annotate resource class methods with standard method
   • @GET, @PUT, @POST, @DELETE, @HEAD
   • @HttpMethod meta-annotation allows extensions, e.g. WebDAV
• JAX-RS routes request to appropriate resource class and
  method
• Flexible method signatures, annotations on parameters
  specify mapping from request
• Return value mapped to response




                                                                  13
Standard Set of Methods

@Path("properties/{name}")
public class SystemProperty {

    @GET
    Property get(@PathParam("name") String name)
      {...}

    @PUT
    Property set(@PathParam("name") String name,
      String value) {...}

}


                                                   14
Multiple Representations
• Offer data in a variety of formats
  • XML
  • JSON
  • (X)HTML
• Maximize reach
• Support content negotiation
  • Accept header
    GET /foo
    Accept: application/json
  • URI-based
    GET /foo.json



                                       15
Resource Representations

• Representation format identified by media
 type. E.g.:
 • XML - application/properties+xml
 • JSON - application/properties+json
 • (X)HTML+microformats - application/xhtml+xml
• JAX-RS automates content negotiation
 • GET /foo
   Accept: application/properties+json




                                                  16
Multiple Representations

• Static - Annotate methods or classes with static capabilities
   • @Produces, @Consumes
• Dynamic - Use Variant, VariantListBuilder and
 Request.selectVariant for dynamic capabilities




                                                                  17
Content Negotiation: Accept Header

Accept: application/xml
Accept: application/json;q=1.0, text/xml;q=0.5, application/xml;q=0.5,

@GET
@Produces({"application/xml","application/json"})
Order getOrder(@PathParam("order_id") String id) {
  ...
}

@GET
@Produces("text/plain")
String getOrder2(@PathParam("order_id") String id) {
  ...
}



                                                                         18
Content Negotiation: URL-based
@Path("/orders")
public class OrderResource {
    @Path("{orderId}.xml")
    @GET
    public Order getOrderInXML(@PathParam("orderId") String
orderId) {
      . . .
    }

    @Path("{orderId}.json")
    @GET
    public Order getOrderInJSON(@PathParam("orderId") String
orderId) {
       . . .
    }
}




                                                               19
Content Negotiation: Dynamic




                               20
JAX-RS 1.1
Code Sample

import javax.inject.Inject;
import
javax.enterprise.context.RequestScoped;

@RequestScoped
public class ActorResource {
    @Inject DatbaseBean db;

    public Actor getActor(int id) {
        return db.findActorById(id);
    }
}




                                          21
Content Negotiation
import   javax.ws.rs.GET;
import   javax.ws.rs.Path;
import   javax.ws.rs.Produces;
import   javax.ws.rs.PathParam;
import   javax.inject.Inject;
import   javax.enterprise.context.RequestScoped;

@Path("/actor/{id}")
@RequestScoped
public class ActorResource {
    @Inject DatbaseBean db;

    @GET
    @Produces("application/json")
    public Actor getActor(@PathParam("id") int id) {
         return db.findActorById(id);
    }
}                 http://blogs.sun.com/arungupta/entry/totd_124_using_cdi_jpa


                                                                                22
Link Things Together


<order self="http://example.com/orders/101230">
  <customer ref="http://example.com/customers/bar">
  <product ref="http://example.com/products/21034"/>
  <amount value="1"/>
</order>




                                                   23
Responses Contain Links

HTTP/1.1 201 Created
Date: Wed, 03 Jun 2009 16:41:58 GMT
Server: Apache/1.3.6
Location: http://example.com/properties/foo
Content-Type: application/order+xml
Content-Length: 184

<property self="http://example.com/properties/foo">
  <parent ref="http://example.com/properties/bar"/>
  <name>Foo</name>
  <value>1</value>
</order>




                                                      24
Responses Contain Links

• UriInfo provides information about deployment context,
  the request URI and the route to the resource
• UriBuilder provides facilities to easily construct URIs for
  resources




                                                                25
Responses Contain Links

@Context UriInfo i;

SystemProperty p = ...
UriBuilder b = i.getBaseUriBuilder();
URI u = b.path(SystemProperties.class)
   .path(p.getName()).build();

List<URI> ancestors = i.getMatchedURIs();
URI parent = ancestors.get(1);




                                            26
Stateless Communications


• Long lived identifiers
• Avoid sessions
• Everything required to process a request
 contained in the request




                                             27
JAX-RS Summary


• Java API for building RESTful Web Services
• POJO based
• Annotation-driven
• Server-side API
• HTTP-centric




                                           28
JAX-RS 1.1
    More Code Samples

• Processing POSTed HTML
Form
@POST
@Consumes("application/x-www-form-urlencoded")
public void post(@FormParam("name") String name) {
     // Store the message
• Sub-Resources
}
@Singleton
@Path("/printers")
public class PrintersResource {

    @GET @Path("/list")
    @Produces({"application/json", "application/xml"})
    public WebResourceList getListOfPrinters() { ... }

    @GET @Path("/ids/{printerid}")
    @Produces({"application/json", "application/xml"})
    public Printer getPrinter(@PathParam("printerid") String printerId) { ...
}


                                                                            29
JAX-RS 1.1
        Integration with Java EE 6 – Servlets 3.0

    • No or Portable “web.xml”
<web-app>                                                 @ApplicationPath(“resources”)
  <servlet>
    <servlet-name>Jersey Web Application</servlet-name>   public class MyApplication
    <servlet-class>                                          extends
                                                             javax.ws.rs.core.Application
com.sun.jersey.spi.container.servlet.ServletContainer
    </servlet-class>                                      {
    <init-param>                                          }
      <param-name>javax.ws.rs.Application</param-name>
      <param-value>com.foo.MyApplication</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>Jersey Web Application</servlet-name>
    <url-pattern>/resources/*</url-pattern>
  </servlet-mapping>
</web-app>




                                                                                            30
JAX-RS 1.1
    Integration with Java EE 6 – EJB 3.1

• Use stateless or singleton EJBs in the
    WAR as resource and provider classes
@Path(“stateless”)
@Stateless                                  @Singleton
public class MyStatelessRootResource {      public class MyStatelessResource {
    @Context UriInfo ui;                            @Context UriInfo ui;


    @GET                                        …
    public String get() { return “GET”; }   }

    @EJB MyStatelessResource subResource;


    @Path(“sub-resource”)
    public MyStatelessResource sub() {
      return subResource;
    }
}


                                                                            31
JAX-RS 1.1
 Jersey Client-side API

• Consume HTTP-based RESTful Services
• Easy-to-use
 • Better than HttpURLConnection!
• Reuses JAX-RS API
 • Resources and URI are first-class citizens
• Not part of JAX-RS yet
 • com.sun.jersey.api.client




                                                32
JAX-RS 1.1
   Jersey Client API – Code Sample

Client client = Client.create();

WebResource resource = client.resource(“...”);

//curl http://example.com/base
String s = resource.get(String.class);

//curl -HAccept:text/plain http://example.com/base
String s = resource.
        accept(“text/plain”).
        get(String.class);

http://blogs.sun.com/enterprisetechtips/entry/consuming_restful_web_services_w
ith

                                                                                 33
JAX-RS 1.1
Jersey Client API – NetBeans Code Generation




                                               34
JAX-RS 1.1
  WADL Representation of Resources

• Machine processable description of
  HTTP-based Applications
• Generated OOTB for the application
<application xmlns="http://research.sun.com/wadl/2006/10">
  <doc xmlns:jersey="http://jersey.dev.java.net/"
       jersey:generatedBy="Jersey: 1.1.4.1 11/24/2009 01:37
AM"/>
  <resources base="http://localhost:8080/HelloWADL/resources/">

    <resource path="generic">
      <method id="getText" name="GET">
        <response>
          <representation mediaType="text/plain"/>
        </response>
      </method>
      <method id="putText" name="PUT">
        <request>
          <representation mediaType="text/plain"/>
        </request>
      </method>
    </resource>
  </resources>
</application>



                                                                  35
Java SE Deployment

• RuntimeDelegate is used to create instances of a
 desired endpoint class
• Application supplies configuration information

  • List of resource classes and providers as subclass of
    Application
• Implementations can support any Java type
   • Jersey supports Grizzly (see below), LW HTTP server and JAX-WS
     Provider




                                                                      36
Example Java SE Deployment

Application app = ...
RuntimeDelegate rd = RuntimeDelegate.getInstance();
Adapter a = rd.createEndpoint(app, Adapter.class);

SelectorThread st = GrizzlyServerFactory.create(
    “http://127.0.0.1:8084/”, a);




                                                      37
Servlet
• JAX-RS application packaged in WAR like a servlet
• For JAX-RS aware containers
   • web.xml can point to Application subclass
• For non-JAX-RS aware containers
   • web.xml points to implementation-specific Servlet; and
   • an init-param identifies the Application subclass
• Resource classes and providers can access Servlet
 request, context, config and response via injection




                                                              38
Java EE
• Resource class can be an EJB session or singleton bean
• Providers can be an EJB stateless session or singleton
  bean
• JAX-RS annotations on local interface or no-interface bean
• If JCDI (JSR 299) also supported then
  • Resource classes can be JCDI beans
  • Providers can be JCDI beans with application scope
• Full access to facilities of native component model, e.g.
 resource injection




                                                               39
JAX-RS status
• JAX-RS 1.0: 18th October 2008
• JAX-RS 1.1: 23rd November 2009
   • Aligned with Java EE 6, but not in the Web
     profile!
• JAX-RS 2.0: Future<?>
• Implementations
   • Apache CXF, Apache Wink, eXo, Jersey,
     RESTEasy, Restlet, Triaxrs


                                          40      40
The Future<?>

• JAX-RS 1.0 is 2 years old
• Implementations have innovated in that 2 year
 period... and other frameworks
 • Play, SiteBricks, Scalate, Spring, VRaptor
• JAX-RS 2.0 should take innovations that work
 well and standardize
 • Premature standardization is a root of evil




                                                 41
Jersey




 Open source, production quality,
   reference implementation
         … and more ...

                                    42
GET /Samples

• Many samples are provided with the release
  • Atom, JAXB, JSON, Scala, Spring, WADL
  • Using GlassFish (+embedded) and Grizzly
• Download the 1.1.0 samples
  • Samples are maven-based
  • Works with NetBeans 6.x + maven plugin
  • Individual sample zip files are also available
     • e.g. Sparklines, Mandel




                                                     43
GET /Involved
• Ask/answer questions, propose fixes/features
  • mailto:users@jersey.dev.java.net




                                                 44
GET /Features

• Client API
• JSON with JAXB
• Spring and Guice integration
• MIME multipart API
• Atom with Abdera API
• WADL
• Grizzly and Simple servers




                                 45
JAX-RS 2.0
    http://markmail.org/thread/wgm3hj3rrva3j6jo


●
    Client API
    ●
        Low level using Builder pattern, Higher-level
●
    Hypermedia
●
    MVC Pattern
    ●
        Resource controllers, Pluggable viewing technology
●
    Bean Validation
    ●
        Form or Query parameter validation
●
    Closer integration with @Inject, etc.
●
    Server-side asynchronous request processing
●
    Server-side content negotiation

                                                             46
References


• oracle.com/goto/glassfish
• glassfish.org
• blogs.sun.com/theaquarium
• youtube.com/user/GlassFishVideos
• Follow @glassfish




                                     47
<Insert Picture Here>




Developing RESTful Web services with JAX-RS
Arun Gupta, Java EE & GlassFish Guy
blogs.sun.com/arungupta, @arungupta

More Related Content

What's hot

Front End Development for Backend Developers - GIDS 2019
Front End Development for Backend Developers - GIDS 2019Front End Development for Backend Developers - GIDS 2019
Front End Development for Backend Developers - GIDS 2019Matt Raible
 
Choosing a Java Web Framework
Choosing a Java Web FrameworkChoosing a Java Web Framework
Choosing a Java Web FrameworkWill Iverson
 
Bootiful Development with Spring Boot and React - UberConf 2018
Bootiful Development with Spring Boot and React - UberConf 2018Bootiful Development with Spring Boot and React - UberConf 2018
Bootiful Development with Spring Boot and React - UberConf 2018Matt Raible
 
Comparing JVM Web Frameworks - Rich Web Experience 2010
Comparing JVM Web Frameworks - Rich Web Experience 2010Comparing JVM Web Frameworks - Rich Web Experience 2010
Comparing JVM Web Frameworks - Rich Web Experience 2010Matt Raible
 
Seven Simple Reasons to Use AppFuse
Seven Simple Reasons to Use AppFuseSeven Simple Reasons to Use AppFuse
Seven Simple Reasons to Use AppFuseMatt Raible
 
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...Matt Raible
 
Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Matt Raible
 
Spring Boot APIs and Angular Apps: Get Hip with JHipster! KCDC 2019
Spring Boot APIs and Angular Apps: Get Hip with JHipster! KCDC 2019Spring Boot APIs and Angular Apps: Get Hip with JHipster! KCDC 2019
Spring Boot APIs and Angular Apps: Get Hip with JHipster! KCDC 2019Matt Raible
 
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020Matt Raible
 
How to Win at UI Development in the World of Microservices - THAT Conference ...
How to Win at UI Development in the World of Microservices - THAT Conference ...How to Win at UI Development in the World of Microservices - THAT Conference ...
How to Win at UI Development in the World of Microservices - THAT Conference ...Matt Raible
 
Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Matt Raible
 
Java Web Application Security - UberConf 2011
Java Web Application Security - UberConf 2011Java Web Application Security - UberConf 2011
Java Web Application Security - UberConf 2011Matt Raible
 
What's New in Spring 3.1
What's New in Spring 3.1What's New in Spring 3.1
What's New in Spring 3.1Matt Raible
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Matt Raible
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Matt Raible
 
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache TomcatCase Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache TomcatVMware Hyperic
 
Apache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-onApache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-onMatt Raible
 
JavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
JavaOne India 2011 - Running your Java EE 6 Apps in the CloudJavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
JavaOne India 2011 - Running your Java EE 6 Apps in the CloudArun Gupta
 
Web App Security for Java Developers - UberConf 2021
Web App Security for Java Developers - UberConf 2021Web App Security for Java Developers - UberConf 2021
Web App Security for Java Developers - UberConf 2021Matt Raible
 
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Matt Raible
 

What's hot (20)

Front End Development for Backend Developers - GIDS 2019
Front End Development for Backend Developers - GIDS 2019Front End Development for Backend Developers - GIDS 2019
Front End Development for Backend Developers - GIDS 2019
 
Choosing a Java Web Framework
Choosing a Java Web FrameworkChoosing a Java Web Framework
Choosing a Java Web Framework
 
Bootiful Development with Spring Boot and React - UberConf 2018
Bootiful Development with Spring Boot and React - UberConf 2018Bootiful Development with Spring Boot and React - UberConf 2018
Bootiful Development with Spring Boot and React - UberConf 2018
 
Comparing JVM Web Frameworks - Rich Web Experience 2010
Comparing JVM Web Frameworks - Rich Web Experience 2010Comparing JVM Web Frameworks - Rich Web Experience 2010
Comparing JVM Web Frameworks - Rich Web Experience 2010
 
Seven Simple Reasons to Use AppFuse
Seven Simple Reasons to Use AppFuseSeven Simple Reasons to Use AppFuse
Seven Simple Reasons to Use AppFuse
 
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
Mobile Development with Ionic, React Native, and JHipster - ACGNJ Java Users ...
 
Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021
 
Spring Boot APIs and Angular Apps: Get Hip with JHipster! KCDC 2019
Spring Boot APIs and Angular Apps: Get Hip with JHipster! KCDC 2019Spring Boot APIs and Angular Apps: Get Hip with JHipster! KCDC 2019
Spring Boot APIs and Angular Apps: Get Hip with JHipster! KCDC 2019
 
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
Mobile Development with Ionic, React Native, and JHipster - AllTheTalks 2020
 
How to Win at UI Development in the World of Microservices - THAT Conference ...
How to Win at UI Development in the World of Microservices - THAT Conference ...How to Win at UI Development in the World of Microservices - THAT Conference ...
How to Win at UI Development in the World of Microservices - THAT Conference ...
 
Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019Front End Development for Back End Java Developers - NYJavaSIG 2019
Front End Development for Back End Java Developers - NYJavaSIG 2019
 
Java Web Application Security - UberConf 2011
Java Web Application Security - UberConf 2011Java Web Application Security - UberConf 2011
Java Web Application Security - UberConf 2011
 
What's New in Spring 3.1
What's New in Spring 3.1What's New in Spring 3.1
What's New in Spring 3.1
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache TomcatCase Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
 
Apache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-onApache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-on
 
JavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
JavaOne India 2011 - Running your Java EE 6 Apps in the CloudJavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
JavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
 
Web App Security for Java Developers - UberConf 2021
Web App Security for Java Developers - UberConf 2021Web App Security for Java Developers - UberConf 2021
Web App Security for Java Developers - UberConf 2021
 
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
 

Viewers also liked

TDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE ApplicationTDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE ApplicationArun Gupta
 
Java Summit Chennai: Java EE 7
Java Summit Chennai: Java EE 7Java Summit Chennai: Java EE 7
Java Summit Chennai: Java EE 7Arun Gupta
 
Introduction to JAX-RS @ SIlicon Valley Code Camp 2010
Introduction to JAX-RS @ SIlicon Valley Code Camp 2010Introduction to JAX-RS @ SIlicon Valley Code Camp 2010
Introduction to JAX-RS @ SIlicon Valley Code Camp 2010Arun Gupta
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration BackendArun Gupta
 
The Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the CloudThe Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the CloudArun Gupta
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nationArun Gupta
 
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012Arun Gupta
 

Viewers also liked (7)

TDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE ApplicationTDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE Application
 
Java Summit Chennai: Java EE 7
Java Summit Chennai: Java EE 7Java Summit Chennai: Java EE 7
Java Summit Chennai: Java EE 7
 
Introduction to JAX-RS @ SIlicon Valley Code Camp 2010
Introduction to JAX-RS @ SIlicon Valley Code Camp 2010Introduction to JAX-RS @ SIlicon Valley Code Camp 2010
Introduction to JAX-RS @ SIlicon Valley Code Camp 2010
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration Backend
 
The Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the CloudThe Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the Cloud
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nation
 
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
 

Similar to Spark IT 2011 - Developing RESTful Web services with JAX-RS

RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RSArun Gupta
 
JAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesJAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesLudovic Champenois
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsCarol McDonald
 
Ppt on web development and this has all details
Ppt on web development and this has all detailsPpt on web development and this has all details
Ppt on web development and this has all detailsgogijoshiajmer
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web servicesnbuddharaju
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and ODataAnil Allewar
 
RestFull Webservices with JAX-RS
RestFull Webservices with JAX-RSRestFull Webservices with JAX-RS
RestFull Webservices with JAX-RSNeil Ghosh
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsSagara Gunathunga
 
CDI, Seam & RESTEasy: You haven't seen REST yet!
CDI, Seam & RESTEasy: You haven't seen REST yet!CDI, Seam & RESTEasy: You haven't seen REST yet!
CDI, Seam & RESTEasy: You haven't seen REST yet!Dan Allen
 
Javaone 2010
Javaone 2010Javaone 2010
Javaone 2010Hien Luu
 
Building Restful Web Services with Java
Building Restful Web Services with JavaBuilding Restful Web Services with Java
Building Restful Web Services with JavaVassil Popovski
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVCIndicThreads
 
RESTful application with JAX-RS and how to expose and test them
RESTful application with JAX-RS and how to expose and test themRESTful application with JAX-RS and how to expose and test them
RESTful application with JAX-RS and how to expose and test themKumaraswamy M
 
Network Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyNetwork Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyPayal Jain
 
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010Arun Gupta
 

Similar to Spark IT 2011 - Developing RESTful Web services with JAX-RS (20)

RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RS
 
JAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesJAX-RS Creating RESTFul services
JAX-RS Creating RESTFul services
 
Rest
RestRest
Rest
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
 
Ppt on web development and this has all details
Ppt on web development and this has all detailsPpt on web development and this has all details
Ppt on web development and this has all details
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and OData
 
RestFull Webservices with JAX-RS
RestFull Webservices with JAX-RSRestFull Webservices with JAX-RS
RestFull Webservices with JAX-RS
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rs
 
CDI, Seam & RESTEasy: You haven't seen REST yet!
CDI, Seam & RESTEasy: You haven't seen REST yet!CDI, Seam & RESTEasy: You haven't seen REST yet!
CDI, Seam & RESTEasy: You haven't seen REST yet!
 
Javaone 2010
Javaone 2010Javaone 2010
Javaone 2010
 
Building Restful Web Services with Java
Building Restful Web Services with JavaBuilding Restful Web Services with Java
Building Restful Web Services with Java
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVC
 
RESTful application with JAX-RS and how to expose and test them
RESTful application with JAX-RS and how to expose and test themRESTful application with JAX-RS and how to expose and test them
RESTful application with JAX-RS and how to expose and test them
 
RESTing with JAX-RS
RESTing with JAX-RSRESTing with JAX-RS
RESTing with JAX-RS
 
Jersey
JerseyJersey
Jersey
 
Network Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyNetwork Device Database Management with REST using Jersey
Network Device Database Management with REST using Jersey
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
 

More from Arun Gupta

5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdf5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdfArun Gupta
 
Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019Arun Gupta
 
Machine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and KubernetesMachine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and KubernetesArun Gupta
 
Secure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using FirecrackerSecure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using FirecrackerArun Gupta
 
Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019Arun Gupta
 
Why Amazon Cares about Open Source
Why Amazon Cares about Open SourceWhy Amazon Cares about Open Source
Why Amazon Cares about Open SourceArun Gupta
 
Machine learning using Kubernetes
Machine learning using KubernetesMachine learning using Kubernetes
Machine learning using KubernetesArun Gupta
 
Building Cloud Native Applications
Building Cloud Native ApplicationsBuilding Cloud Native Applications
Building Cloud Native ApplicationsArun Gupta
 
Chaos Engineering with Kubernetes
Chaos Engineering with KubernetesChaos Engineering with Kubernetes
Chaos Engineering with KubernetesArun Gupta
 
How to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAMHow to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAMArun Gupta
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Arun Gupta
 
The Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteThe Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteArun Gupta
 
Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018Arun Gupta
 
Mastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitMastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitArun Gupta
 
Top 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's LandscapeTop 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's LandscapeArun Gupta
 
Container Landscape in 2017
Container Landscape in 2017Container Landscape in 2017
Container Landscape in 2017Arun Gupta
 
Java EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftJava EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftArun Gupta
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersDocker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersArun Gupta
 
Thanks Managers!
Thanks Managers!Thanks Managers!
Thanks Managers!Arun Gupta
 
Migrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to ContainersMigrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to ContainersArun Gupta
 

More from Arun Gupta (20)

5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdf5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdf
 
Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019
 
Machine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and KubernetesMachine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and Kubernetes
 
Secure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using FirecrackerSecure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using Firecracker
 
Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019
 
Why Amazon Cares about Open Source
Why Amazon Cares about Open SourceWhy Amazon Cares about Open Source
Why Amazon Cares about Open Source
 
Machine learning using Kubernetes
Machine learning using KubernetesMachine learning using Kubernetes
Machine learning using Kubernetes
 
Building Cloud Native Applications
Building Cloud Native ApplicationsBuilding Cloud Native Applications
Building Cloud Native Applications
 
Chaos Engineering with Kubernetes
Chaos Engineering with KubernetesChaos Engineering with Kubernetes
Chaos Engineering with Kubernetes
 
How to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAMHow to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAM
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018
 
The Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteThe Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 Keynote
 
Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018
 
Mastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitMastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv Summit
 
Top 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's LandscapeTop 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's Landscape
 
Container Landscape in 2017
Container Landscape in 2017Container Landscape in 2017
Container Landscape in 2017
 
Java EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftJava EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShift
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersDocker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developers
 
Thanks Managers!
Thanks Managers!Thanks Managers!
Thanks Managers!
 
Migrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to ContainersMigrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to Containers
 

Recently uploaded

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Recently uploaded (20)

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Spark IT 2011 - Developing RESTful Web services with JAX-RS

  • 1. <Insert Picture Here> Developing RESTful Web services with JAX-RS Arun Gupta, Java EE & GlassFish Guy blogs.sun.com/arungupta, @arungupta
  • 2. The following/preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. REST is an Architectural Style Style of software architecture for distributed hypermedia systems such as World Wide Web 3
  • 4. RESTful Web Services Application of REST architectural style to services that utilize Web standards (URIs, HTTP, HTML, XML, Atom, RDF etc.) 4
  • 5. Java API for RESTful Web Services (JAX-RS) Standard annotation-driven API that aims to help developers build RESTful Web services in Java 5
  • 6. RESTful Application Cycle Resources are identified by URIs ↓ Clients communicate with resources via requests using a standard set of methods ↓ Requests and responses contain resource representations in formats identified by media types ↓ Responses contain URIs that link to further resources 6
  • 7. Principles of REST • Give everything an ID • Standard set of methods • Link things together • Multiple representations • Stateless communications 7
  • 8. Give Everything an ID • ID is a URI http://example.com/widgets/foo http://example.com/customers/bar http://example.com/customers/bar/orders/2 http://example.com/orders/101230/customer 8
  • 9. Resources are identified by URIs http://example.com/widgets/foo http://example.com/customers/bar http://example.com/customers/bar/orders/2 http://example.com/orders/101230/customer 9
  • 10. Resources are identified by URIs • Resource == Java class • POJO • No required interfaces • ID provided by @Path annotation • Value is relative URI, base URI is provided by deployment context or parent resource • Embedded parameters for non-fixed parts of the URI • Annotate class or “sub-resource locator” method 10
  • 11. Resources are identified by URIs @Path("orders/{order_id}") public class OrderResource { @GET @Path("customer") CustomerResource getCustomer(...) {...} } 11
  • 12. Standard Set of Methods Method Purpose GET Read, possibly cached POST Update or create without a known ID PUT Update or create with a known ID DELETE Remove 12
  • 13. Standard Set of Methods • Annotate resource class methods with standard method • @GET, @PUT, @POST, @DELETE, @HEAD • @HttpMethod meta-annotation allows extensions, e.g. WebDAV • JAX-RS routes request to appropriate resource class and method • Flexible method signatures, annotations on parameters specify mapping from request • Return value mapped to response 13
  • 14. Standard Set of Methods @Path("properties/{name}") public class SystemProperty { @GET Property get(@PathParam("name") String name) {...} @PUT Property set(@PathParam("name") String name, String value) {...} } 14
  • 15. Multiple Representations • Offer data in a variety of formats • XML • JSON • (X)HTML • Maximize reach • Support content negotiation • Accept header GET /foo Accept: application/json • URI-based GET /foo.json 15
  • 16. Resource Representations • Representation format identified by media type. E.g.: • XML - application/properties+xml • JSON - application/properties+json • (X)HTML+microformats - application/xhtml+xml • JAX-RS automates content negotiation • GET /foo Accept: application/properties+json 16
  • 17. Multiple Representations • Static - Annotate methods or classes with static capabilities • @Produces, @Consumes • Dynamic - Use Variant, VariantListBuilder and Request.selectVariant for dynamic capabilities 17
  • 18. Content Negotiation: Accept Header Accept: application/xml Accept: application/json;q=1.0, text/xml;q=0.5, application/xml;q=0.5, @GET @Produces({"application/xml","application/json"}) Order getOrder(@PathParam("order_id") String id) { ... } @GET @Produces("text/plain") String getOrder2(@PathParam("order_id") String id) { ... } 18
  • 19. Content Negotiation: URL-based @Path("/orders") public class OrderResource { @Path("{orderId}.xml") @GET public Order getOrderInXML(@PathParam("orderId") String orderId) { . . . } @Path("{orderId}.json") @GET public Order getOrderInJSON(@PathParam("orderId") String orderId) { . . . } } 19
  • 21. JAX-RS 1.1 Code Sample import javax.inject.Inject; import javax.enterprise.context.RequestScoped; @RequestScoped public class ActorResource { @Inject DatbaseBean db; public Actor getActor(int id) { return db.findActorById(id); } } 21
  • 22. Content Negotiation import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.PathParam; import javax.inject.Inject; import javax.enterprise.context.RequestScoped; @Path("/actor/{id}") @RequestScoped public class ActorResource { @Inject DatbaseBean db; @GET @Produces("application/json") public Actor getActor(@PathParam("id") int id) { return db.findActorById(id); } } http://blogs.sun.com/arungupta/entry/totd_124_using_cdi_jpa 22
  • 23. Link Things Together <order self="http://example.com/orders/101230"> <customer ref="http://example.com/customers/bar"> <product ref="http://example.com/products/21034"/> <amount value="1"/> </order> 23
  • 24. Responses Contain Links HTTP/1.1 201 Created Date: Wed, 03 Jun 2009 16:41:58 GMT Server: Apache/1.3.6 Location: http://example.com/properties/foo Content-Type: application/order+xml Content-Length: 184 <property self="http://example.com/properties/foo"> <parent ref="http://example.com/properties/bar"/> <name>Foo</name> <value>1</value> </order> 24
  • 25. Responses Contain Links • UriInfo provides information about deployment context, the request URI and the route to the resource • UriBuilder provides facilities to easily construct URIs for resources 25
  • 26. Responses Contain Links @Context UriInfo i; SystemProperty p = ... UriBuilder b = i.getBaseUriBuilder(); URI u = b.path(SystemProperties.class) .path(p.getName()).build(); List<URI> ancestors = i.getMatchedURIs(); URI parent = ancestors.get(1); 26
  • 27. Stateless Communications • Long lived identifiers • Avoid sessions • Everything required to process a request contained in the request 27
  • 28. JAX-RS Summary • Java API for building RESTful Web Services • POJO based • Annotation-driven • Server-side API • HTTP-centric 28
  • 29. JAX-RS 1.1 More Code Samples • Processing POSTed HTML Form @POST @Consumes("application/x-www-form-urlencoded") public void post(@FormParam("name") String name) { // Store the message • Sub-Resources } @Singleton @Path("/printers") public class PrintersResource { @GET @Path("/list") @Produces({"application/json", "application/xml"}) public WebResourceList getListOfPrinters() { ... } @GET @Path("/ids/{printerid}") @Produces({"application/json", "application/xml"}) public Printer getPrinter(@PathParam("printerid") String printerId) { ... } 29
  • 30. JAX-RS 1.1 Integration with Java EE 6 – Servlets 3.0 • No or Portable “web.xml” <web-app> @ApplicationPath(“resources”) <servlet> <servlet-name>Jersey Web Application</servlet-name> public class MyApplication <servlet-class> extends javax.ws.rs.core.Application com.sun.jersey.spi.container.servlet.ServletContainer </servlet-class> { <init-param> } <param-name>javax.ws.rs.Application</param-name> <param-value>com.foo.MyApplication</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>Jersey Web Application</servlet-name> <url-pattern>/resources/*</url-pattern> </servlet-mapping> </web-app> 30
  • 31. JAX-RS 1.1 Integration with Java EE 6 – EJB 3.1 • Use stateless or singleton EJBs in the WAR as resource and provider classes @Path(“stateless”) @Stateless @Singleton public class MyStatelessRootResource { public class MyStatelessResource { @Context UriInfo ui; @Context UriInfo ui; @GET … public String get() { return “GET”; } } @EJB MyStatelessResource subResource; @Path(“sub-resource”) public MyStatelessResource sub() { return subResource; } } 31
  • 32. JAX-RS 1.1 Jersey Client-side API • Consume HTTP-based RESTful Services • Easy-to-use • Better than HttpURLConnection! • Reuses JAX-RS API • Resources and URI are first-class citizens • Not part of JAX-RS yet • com.sun.jersey.api.client 32
  • 33. JAX-RS 1.1 Jersey Client API – Code Sample Client client = Client.create(); WebResource resource = client.resource(“...”); //curl http://example.com/base String s = resource.get(String.class); //curl -HAccept:text/plain http://example.com/base String s = resource. accept(“text/plain”). get(String.class); http://blogs.sun.com/enterprisetechtips/entry/consuming_restful_web_services_w ith 33
  • 34. JAX-RS 1.1 Jersey Client API – NetBeans Code Generation 34
  • 35. JAX-RS 1.1 WADL Representation of Resources • Machine processable description of HTTP-based Applications • Generated OOTB for the application <application xmlns="http://research.sun.com/wadl/2006/10"> <doc xmlns:jersey="http://jersey.dev.java.net/" jersey:generatedBy="Jersey: 1.1.4.1 11/24/2009 01:37 AM"/> <resources base="http://localhost:8080/HelloWADL/resources/"> <resource path="generic"> <method id="getText" name="GET"> <response> <representation mediaType="text/plain"/> </response> </method> <method id="putText" name="PUT"> <request> <representation mediaType="text/plain"/> </request> </method> </resource> </resources> </application> 35
  • 36. Java SE Deployment • RuntimeDelegate is used to create instances of a desired endpoint class • Application supplies configuration information • List of resource classes and providers as subclass of Application • Implementations can support any Java type • Jersey supports Grizzly (see below), LW HTTP server and JAX-WS Provider 36
  • 37. Example Java SE Deployment Application app = ... RuntimeDelegate rd = RuntimeDelegate.getInstance(); Adapter a = rd.createEndpoint(app, Adapter.class); SelectorThread st = GrizzlyServerFactory.create( “http://127.0.0.1:8084/”, a); 37
  • 38. Servlet • JAX-RS application packaged in WAR like a servlet • For JAX-RS aware containers • web.xml can point to Application subclass • For non-JAX-RS aware containers • web.xml points to implementation-specific Servlet; and • an init-param identifies the Application subclass • Resource classes and providers can access Servlet request, context, config and response via injection 38
  • 39. Java EE • Resource class can be an EJB session or singleton bean • Providers can be an EJB stateless session or singleton bean • JAX-RS annotations on local interface or no-interface bean • If JCDI (JSR 299) also supported then • Resource classes can be JCDI beans • Providers can be JCDI beans with application scope • Full access to facilities of native component model, e.g. resource injection 39
  • 40. JAX-RS status • JAX-RS 1.0: 18th October 2008 • JAX-RS 1.1: 23rd November 2009 • Aligned with Java EE 6, but not in the Web profile! • JAX-RS 2.0: Future<?> • Implementations • Apache CXF, Apache Wink, eXo, Jersey, RESTEasy, Restlet, Triaxrs 40 40
  • 41. The Future<?> • JAX-RS 1.0 is 2 years old • Implementations have innovated in that 2 year period... and other frameworks • Play, SiteBricks, Scalate, Spring, VRaptor • JAX-RS 2.0 should take innovations that work well and standardize • Premature standardization is a root of evil 41
  • 42. Jersey Open source, production quality, reference implementation … and more ... 42
  • 43. GET /Samples • Many samples are provided with the release • Atom, JAXB, JSON, Scala, Spring, WADL • Using GlassFish (+embedded) and Grizzly • Download the 1.1.0 samples • Samples are maven-based • Works with NetBeans 6.x + maven plugin • Individual sample zip files are also available • e.g. Sparklines, Mandel 43
  • 44. GET /Involved • Ask/answer questions, propose fixes/features • mailto:users@jersey.dev.java.net 44
  • 45. GET /Features • Client API • JSON with JAXB • Spring and Guice integration • MIME multipart API • Atom with Abdera API • WADL • Grizzly and Simple servers 45
  • 46. JAX-RS 2.0 http://markmail.org/thread/wgm3hj3rrva3j6jo ● Client API ● Low level using Builder pattern, Higher-level ● Hypermedia ● MVC Pattern ● Resource controllers, Pluggable viewing technology ● Bean Validation ● Form or Query parameter validation ● Closer integration with @Inject, etc. ● Server-side asynchronous request processing ● Server-side content negotiation 46
  • 47. References • oracle.com/goto/glassfish • glassfish.org • blogs.sun.com/theaquarium • youtube.com/user/GlassFishVideos • Follow @glassfish 47
  • 48. <Insert Picture Here> Developing RESTful Web services with JAX-RS Arun Gupta, Java EE & GlassFish Guy blogs.sun.com/arungupta, @arungupta