SlideShare uma empresa Scribd logo
1 de 44
Baixar para ler offline
<Insert Picture Here>




Developing RESTful Web services with JAX-RS
Arun Gupta, Java EE & GlassFish Guy
blogs.oracle.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

• 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




                                                               9
Resources are identified by URIs

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

    @GET
    @Path("customer")
    Customer getCustomer(@PathParam(“order_id”)int id {
      …
    }
}




                                                          10
Standard Set of Methods

Method    Purpose                               Annotation
GET       Read, possibly cached                 @GET
POST      Update or create without a known ID   @POST
PUT       Update or create with a known ID      @PUT
DELETE    Remove                                @DELETE
HEAD      GET with no response                  @HEAD
OPTIONS   Supported methods                     @OPTIONS




                                                             11
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




                                                                  12
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) {...}

}



                                                   13
Binding Request to Resource
Annotation     Sample
@PathParam     Binds the value from URI, e.g.
               @PathParam(“id”)
@QueryParam    Binds the value of query name/value, e.g.
               @QueryParam(“name”)
@CookieParam   Binds the value of a cookie, e.g.
               @CookieParam(“JSESSIONID”)
@HeaderParam   Binds the value of a HTTP header , e.g.
               @HeaderParam("Accept")
@FormParam     Binds the value of an HTML form, e.g.
               @FormParam(“name”)
@MatrixParam   Binds the value of a matrix parameter, e.g.
               @MatrixParam(“name”)




                                                             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")
    @Produces(“application/xml”)
    @GET
    public Order getOrderInXML(@PathParam("orderId") String
orderId) {
      . . .
    }

    @Path("{orderId}.json")
    @Produces(“application/json”)
    @GET
    public Order getOrderInJSON(@PathParam("orderId") String
orderId) {
       . . .
    }
}



                                                               19
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);
    }
}




                                                 20
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.oracle.com/arungupta/entry/totd_124_using_cdi_jpa


                                                                                   21
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>




                                                   22
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>




                                                      23
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




                                                                24
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);




                                            25
Stateless Communications


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




                                             26
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) { ...
}


                                                                            27
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>




                                                                                         28
Mapping Application Exceptions

    • Map checked or runtime exception to Response

public class OrderNotFoundException extends RuntimeException {

    public OrderNotFoundException(int id)
      super(id + " order not found");
    }

}                   @Path("{id}")
                    public Order getOrder(@PathParam("id")int id) {
                      Order order = null;
                      . . .
                      return order;
                      if (order == null)
                        throw new OrderNotFoundException(id);
                    }


                                                              29
Mapping Application Exceptions


@Provider
public class OrderNotFoundExceptionMapper implements
ExceptionMapper<OrderNotFoundException> {

    @Override
    public Response toResponse(OrderNotFoundException exception)
{
        return Response
           .status(Response.Status.PRECONDITION_FAILED)
           .entity("Response not found")
           .build();
    }

}



                                                              30
JAX-RS Summary


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




                                           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;
    }
}


                                                                            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




                                                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.oracle.com/enterprisetechtips/entry/consuming_restful_web_services_with


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




                                               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>



                                                                  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




                                                                      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);




                                                      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




                                                              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<?>
 • 2.0 M3 Available
• Implementations
 • Apache CXF, Apache Wink, eXo, Jersey,
   RESTEasy, Restlet, Triaxrs



                                                         40   40
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




                                                     41
JAX-RS 2.0 (JSR 339)
    http://jcp.org/en/jsr/detail?id=339
    http://jax-rs-spec.java.net

●
    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

                                                              42
References


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




                                 43
<Insert Picture Here>




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

Mais conteúdo relacionado

Mais procurados

WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0Jeffrey West
 
Introduction to RESTful Webservices in JAVA
Introduction to RESTful Webservices  in JAVA Introduction to RESTful Webservices  in JAVA
Introduction to RESTful Webservices in JAVA psrpatnaik
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web servicesnbuddharaju
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuseejlp12
 
Java Web Programming [3/9] : Servlet Advanced
Java Web Programming [3/9] : Servlet AdvancedJava Web Programming [3/9] : Servlet Advanced
Java Web Programming [3/9] : Servlet AdvancedIMC Institute
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RSFahad Golra
 
JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup Sagara Gunathunga
 
Java Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicJava Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicIMC Institute
 
Cwinters Intro To Rest And JerREST and Jersey Introductionsey
Cwinters Intro To Rest And JerREST and Jersey IntroductionseyCwinters Intro To Rest And JerREST and Jersey Introductionsey
Cwinters Intro To Rest And JerREST and Jersey Introductionseyelliando dias
 
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
 
Expose your data as an api is with oracle rest data services -spoug Madrid
Expose your data as an api is with oracle rest data services -spoug MadridExpose your data as an api is with oracle rest data services -spoug Madrid
Expose your data as an api is with oracle rest data services -spoug MadridVinay Kumar
 
ORDS - Oracle REST Data Services
ORDS - Oracle REST Data ServicesORDS - Oracle REST Data Services
ORDS - Oracle REST Data ServicesJustin Michael Raj
 
Survey of restful web services frameworks
Survey of restful web services frameworksSurvey of restful web services frameworks
Survey of restful web services frameworksVijay Prasad Gupta
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API RecommendationsJeelani Shaik
 
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010Arun Gupta
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHPZoran Jeremic
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nationArun Gupta
 

Mais procurados (20)

WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0
 
Introduction to RESTful Webservices in JAVA
Introduction to RESTful Webservices  in JAVA Introduction to RESTful Webservices  in JAVA
Introduction to RESTful Webservices in JAVA
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
Java Web Programming [3/9] : Servlet Advanced
Java Web Programming [3/9] : Servlet AdvancedJava Web Programming [3/9] : Servlet Advanced
Java Web Programming [3/9] : Servlet Advanced
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RS
 
JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup
 
Java Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicJava Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet Basic
 
Cwinters Intro To Rest And JerREST and Jersey Introductionsey
Cwinters Intro To Rest And JerREST and Jersey IntroductionseyCwinters Intro To Rest And JerREST and Jersey Introductionsey
Cwinters Intro To Rest And JerREST and Jersey Introductionsey
 
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
 
Expose your data as an api is with oracle rest data services -spoug Madrid
Expose your data as an api is with oracle rest data services -spoug MadridExpose your data as an api is with oracle rest data services -spoug Madrid
Expose your data as an api is with oracle rest data services -spoug Madrid
 
ORDS - Oracle REST Data Services
ORDS - Oracle REST Data ServicesORDS - Oracle REST Data Services
ORDS - Oracle REST Data Services
 
Survey of restful web services frameworks
Survey of restful web services frameworksSurvey of restful web services frameworks
Survey of restful web services frameworks
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
Servlets 3.0 - Asynchronous, Easy, Extensible @ Silicon Valley Code Camp 2010
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
Doing REST Right
Doing REST RightDoing REST Right
Doing REST Right
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nation
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 

Destaque

Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service designRamin Orujov
 
Java Web Apps and Services on Oracle Java Cloud Service
Java Web Apps and Services on Oracle Java Cloud ServiceJava Web Apps and Services on Oracle Java Cloud Service
Java Web Apps and Services on Oracle Java Cloud ServiceAndreas Koop
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
Developing Web Services With Oracle Web Logic Server
Developing Web Services With Oracle Web Logic ServerDeveloping Web Services With Oracle Web Logic Server
Developing Web Services With Oracle Web Logic ServerGaurav Sharma
 
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...IMC Institute
 
Resilient Enterprise Messaging with WSO2 ESB
Resilient Enterprise Messaging with WSO2 ESBResilient Enterprise Messaging with WSO2 ESB
Resilient Enterprise Messaging with WSO2 ESBWSO2
 
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris RechtThe Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris RechtThe Port
 
SAP_Business_Object_Professional
SAP_Business_Object_ProfessionalSAP_Business_Object_Professional
SAP_Business_Object_ProfessionalKapil Verma
 
JUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyondJUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyondSam Brannen
 
Global leader in real-time clearing
Global leader in real-time clearingGlobal leader in real-time clearing
Global leader in real-time clearingCinnober
 
PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012Arun Gupta
 
Implementing Web Services In Java
Implementing Web Services In JavaImplementing Web Services In Java
Implementing Web Services In JavaEdureka!
 
OAuth with Restful Web Services
OAuth with Restful Web Services OAuth with Restful Web Services
OAuth with Restful Web Services Vinay H G
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programmingTOPS Technologies
 
Developing With JAAS
Developing With JAASDeveloping With JAAS
Developing With JAASrahmed_sct
 

Destaque (20)

Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service design
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
Java Web Apps and Services on Oracle Java Cloud Service
Java Web Apps and Services on Oracle Java Cloud ServiceJava Web Apps and Services on Oracle Java Cloud Service
Java Web Apps and Services on Oracle Java Cloud Service
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Developing Web Services With Oracle Web Logic Server
Developing Web Services With Oracle Web Logic ServerDeveloping Web Services With Oracle Web Logic Server
Developing Web Services With Oracle Web Logic Server
 
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
็Hand-on Exercise: Java Web Services using Eclipse + Tomcat & NetBeans + Glas...
 
Resilient Enterprise Messaging with WSO2 ESB
Resilient Enterprise Messaging with WSO2 ESBResilient Enterprise Messaging with WSO2 ESB
Resilient Enterprise Messaging with WSO2 ESB
 
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris RechtThe Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
The Landbank's Role in Driving Redevelopment, UC DAAP by Chris Recht
 
Core & advanced java classes in mumbai
Core & advanced java classes in mumbaiCore & advanced java classes in mumbai
Core & advanced java classes in mumbai
 
SAP_Business_Object_Professional
SAP_Business_Object_ProfessionalSAP_Business_Object_Professional
SAP_Business_Object_Professional
 
JUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyondJUnit 5 - from Lambda to Alpha and beyond
JUnit 5 - from Lambda to Alpha and beyond
 
Global leader in real-time clearing
Global leader in real-time clearingGlobal leader in real-time clearing
Global leader in real-time clearing
 
PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012
 
Implementing Web Services In Java
Implementing Web Services In JavaImplementing Web Services In Java
Implementing Web Services In Java
 
OAuth with Restful Web Services
OAuth with Restful Web Services OAuth with Restful Web Services
OAuth with Restful Web Services
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programming
 
Developing With JAAS
Developing With JAASDeveloping With JAAS
Developing With JAAS
 

Semelhante a Developing RESTful Web services with JAX-RS

Spark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSSpark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSArun Gupta
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011Shreedhar Ganapathy
 
JAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesJAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesLudovic Champenois
 
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
 
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
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and ODataAnil Allewar
 
Javaone 2010
Javaone 2010Javaone 2010
Javaone 2010Hien Luu
 
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
 
Building Restful Web Services with Java
Building Restful Web Services with JavaBuilding Restful Web Services with Java
Building Restful Web Services with JavaVassil Popovski
 
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
 
03 form-data
03 form-data03 form-data
03 form-datasnopteck
 
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
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVCIndicThreads
 
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
 
JAX - RS MuleSoft ESB
JAX - RS MuleSoft ESBJAX - RS MuleSoft ESB
JAX - RS MuleSoft ESBAnkit Shah
 
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
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India
 

Semelhante a Developing RESTful Web services with JAX-RS (20)

Spark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSSpark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RS
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011
 
JAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesJAX-RS Creating RESTFul services
JAX-RS Creating RESTFul services
 
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
 
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
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and OData
 
Javaone 2010
Javaone 2010Javaone 2010
Javaone 2010
 
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!
 
Jersey
JerseyJersey
Jersey
 
Building Restful Web Services with Java
Building Restful Web Services with JavaBuilding Restful Web Services with Java
Building Restful Web Services with Java
 
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
 
Lab swe-2013intro jax-rs
Lab swe-2013intro jax-rsLab swe-2013intro jax-rs
Lab swe-2013intro jax-rs
 
03 form-data
03 form-data03 form-data
03 form-data
 
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
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVC
 
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
 
JAX - RS MuleSoft ESB
JAX - RS MuleSoft ESBJAX - RS MuleSoft ESB
JAX - RS MuleSoft ESB
 
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
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
 

Mais de 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
 

Mais de 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
 

Último

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
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
 
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
 
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
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
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
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
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
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
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
 
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
 

Último (20)

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
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
 
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
 
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
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
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
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
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
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
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
 
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
 

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.oracle.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 • 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 9
  • 10. Resources are identified by URIs @Path("orders/{order_id}") public class OrderResource { @GET @Path("customer") Customer getCustomer(@PathParam(“order_id”)int id { … } } 10
  • 11. Standard Set of Methods Method Purpose Annotation GET Read, possibly cached @GET POST Update or create without a known ID @POST PUT Update or create with a known ID @PUT DELETE Remove @DELETE HEAD GET with no response @HEAD OPTIONS Supported methods @OPTIONS 11
  • 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 12
  • 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) {...} } 13
  • 14. Binding Request to Resource Annotation Sample @PathParam Binds the value from URI, e.g. @PathParam(“id”) @QueryParam Binds the value of query name/value, e.g. @QueryParam(“name”) @CookieParam Binds the value of a cookie, e.g. @CookieParam(“JSESSIONID”) @HeaderParam Binds the value of a HTTP header , e.g. @HeaderParam("Accept") @FormParam Binds the value of an HTML form, e.g. @FormParam(“name”) @MatrixParam Binds the value of a matrix parameter, e.g. @MatrixParam(“name”) 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") @Produces(“application/xml”) @GET public Order getOrderInXML(@PathParam("orderId") String orderId) { . . . } @Path("{orderId}.json") @Produces(“application/json”) @GET public Order getOrderInJSON(@PathParam("orderId") String orderId) { . . . } } 19
  • 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); } } 20
  • 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.oracle.com/arungupta/entry/totd_124_using_cdi_jpa 21
  • 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> 22
  • 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> 23
  • 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 24
  • 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); 25
  • 26. Stateless Communications • Long lived identifiers • Avoid sessions • Everything required to process a request contained in the request 26
  • 27. 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) { ... } 27
  • 28. 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> 28
  • 29. Mapping Application Exceptions • Map checked or runtime exception to Response public class OrderNotFoundException extends RuntimeException { public OrderNotFoundException(int id) super(id + " order not found"); } } @Path("{id}") public Order getOrder(@PathParam("id")int id) { Order order = null; . . . return order; if (order == null) throw new OrderNotFoundException(id); } 29
  • 30. Mapping Application Exceptions @Provider public class OrderNotFoundExceptionMapper implements ExceptionMapper<OrderNotFoundException> { @Override public Response toResponse(OrderNotFoundException exception) { return Response .status(Response.Status.PRECONDITION_FAILED) .entity("Response not found") .build(); } } 30
  • 31. JAX-RS Summary • Java API for building RESTful Web Services • POJO based • Annotation-driven • Server-side API • HTTP-centric 31
  • 32. 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; } } 32
  • 33. 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 33
  • 34. 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.oracle.com/enterprisetechtips/entry/consuming_restful_web_services_with 34
  • 35. JAX-RS 1.1 Jersey Client API – NetBeans Code Generation 35
  • 36. 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> 36
  • 37. 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 37
  • 38. 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); 38
  • 39. 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 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<?> • 2.0 M3 Available • Implementations • Apache CXF, Apache Wink, eXo, Jersey, RESTEasy, Restlet, Triaxrs 40 40
  • 41. 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 41
  • 42. JAX-RS 2.0 (JSR 339) http://jcp.org/en/jsr/detail?id=339 http://jax-rs-spec.java.net ● 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 42
  • 43. References • oracle.com/javaee • glassfish.org • oracle.com/goto/glassfish • blogs.oracle.com/theaquarium • youtube.com/GlassFishVideos • Follow @glassfish 43
  • 44. <Insert Picture Here> Developing RESTful Web services with JAX-RS Arun Gupta, Java EE & GlassFish Guy blogs.oracle.com/arungupta, @arungupta