Click here to load reader

JAX-RS 2.0: RESTful Web services on steroids at Geecon 2012

  • View
    5.813

  • Download
    1

Embed Size (px)

DESCRIPTION

JAX-RS 2.0: RESTful Web services on steroids at Geecon 2012

Text of JAX-RS 2.0: RESTful Web services on steroids at Geecon 2012

  • 1. JAX-RS 2.0: RESTful Java on SteroidsArun Gupta, Java EE & GlassFish Guyhttp://blogs.oracle.com/arungupta, @arungupta 1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 2. The following 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 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 3. Part I: How we got here ?3 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 4. How We Got Here? Shortest intro to JAX-RS 1.0 Requested features for JAX-RS 2.0 JSR 339: JAX-RS 2.04 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 5. JAX-RS Origins JAX-RS 1.0 is Java API for RESTful WS RESTFul Principles: Assign everything an ID Link things together Use common set of methods Allow multiple representations Stateless communications5 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 6. JAX-RS 1.0 Goals POJO-Based API HTTP Centric Format Independence Container Independence Inclusion in Java EE6 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 7. Example: JAX-RS API [email protected]("/atm/{cardId}") URI Parameterpublic class AtmService { Injection @GET @Path("/balance") @Produces("text/plain") public String balance(@PathParam("cardId") String card, @QueryParam("pin") String pin) { return Double.toString(getBalance(card, pin)); } HTTP Method Built-in Binding Serialization 7 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 8. Example: JAX-RS API (contd.) Custom Serialization @POST @Path("/withdrawal") @Consumes("text/plain") @Produces("application/json") public Money withdraw(@PathParam("card") String card, @QueryParam("pin") String pin, String amount){ return getMoney(card, pin, amount); }}8 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 9. Standard Methods9 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 10. Request Mapping10 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 11. Requested Features Filters/Handlers Client API Hypermedia Async JSR 330 Validation Improved Conneg MVC11 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 12. JSR 339 Expert Group EG Formed in March 2011 Oracle Leads: Marek Potociar / Santiago Pericas-G. Expert Group: Jan Algermissen, Florent Benoit, Sergey Beryozkin (Talend), Adam Bien, Bill Burke (RedHat), Clinton Combs, Bill De Hora, Markus Karg, Sastry Malladi (Ebay), Julian Reschke, Guilherme Silveira, Dionysios Synodinos Early Draft 2 published on Feb 9, 2012!12 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 13. Part II: Where We Are Going13 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 14. New in JAX-RS 2.0 Filters/Handlers Client API Hypermedia Async JSR 330 Validation Improved Conneg MVC14 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 15. New in JAX-RS 2.0 Interceptors Client API /Handlers Hypermedia Async JSR 330 Validation Improved Conneg15 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 16. Motivation HTTP client libraries too low level Sharing features with JAX-RS server API E.g., MBRs and MBWs Supported by some JAX-RS 1.0 implementations Need for a standard16 Copyright 2011, Oracle and/or its affiliates. All rights reserved.
  • 17. Client API Resource TargetClient Factory Client atm Configuration Resource Target Configuration Configuration {cardId} Resource Target Resource TargetInvocation Request Builder balance withdrawal Response 17 Copyright

Search related