JSUG - RESTful Web Services by Florian Motlik

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    JSUG - RESTful Web Services by Florian Motlik - Presentation Transcript

    1. RESTful WebServices Florian Motlik
    2. Webservices now RPC Style SOAP is complicated HTTP not fully used (only post) HTTP Tools not usable (proxy, cache, Firewall) Another layer needed for inspection of SOAP Great for Starting Action on Server Not so Great for retrieving State
    3. RESTful Webservices Representational State Transfer Introduced by Roy Fielding in Dissertation http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm One of main Authors of HTTP Specification Web is RESTful Service Roadmap: Design Principles Resources JAX-RS - Java API for Restful WebServices
    4. Design Principles State and Functionality abstracted in resources Representations transferred to Client Different Reps possible (XML, Html, JSON, ...) Addressability for every Resource e.g. every Resource has own URL Uniform Interface Well defined Operations for CRUD Content-Types for Content Negotiation Protocol attributes Client-Server Stateless - No Cookies or other Extensions Cacheable Layered - Caches, Firewalls, Tunnels, ... supported
    5. Resources WebService for determining status of Healthy Food in Healthy Food machine URLS: http://example.com/healthy Gives list of all possible Items http://example.com/healthy/1 Gives info for one product(left, price, ...) Machine is abstracted away as resource Representations can be obtained
    6. JAX-RS Specified in JSR-311 Final Release in October 2008 Uses Annotations heavily Different Implementations Jersey -reference implementation RESTeasy - from JBOSS Working together with SEAM
    7. Simple Example @Path(\"/library\") - Also regular Expressions possible in @Path public class Library { @GET @Path(\"/books\") public String getBooks() {...} @PUT @Path(\"/book/{isbn}\") public void addBook(@PathParam(\"isbn\") String id) {...} @DELETE @Path(\"/book/{id}\") public void removeBook(@PathParam(\"id\") String id {...} }
    8. Further Annotations QueryParam GET /books?num=5 @GET public String getBooks(@QueryParam(\"num\") int num) { } HeaderParam @PUT public void put(@HeaderParam(\"Content-Type\") MediaType contentType) MatrixParam GET http://host.com/library/book;name=SomeBook @GET public String getBook(@MatrixParam(\"name\") String name) {...} CookieParam @GET public String getBooks(@CookieParam(\"sessionid\") int id) {...} DefaultValue @GET public String getBooks(@QueryParam(\"num\") @DefaultValue(\"10\") int num) {...}
    9. Providers Automatic Marshalling and Unmarshalling XML, JSON provided @Consumes or @Produces with content Type onto Method Method returns Object and it is marshalled

    + Christoph PicklChristoph Pickl, 9 months ago

    custom

    575 views, 1 favs, 0 embeds more stats

    visit http://jsug.fsinf.at

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 575
      • 575 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 12
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories