Presentation is loading. Please wait.

Presentation is loading. Please wait.

JAX-RS – REST in Java. Copyright 2007 Tikal Knowledge, Ltd. | 2 | Agenda Introduction Compare to SOAP Server code Client code Frameworks.

Similar presentations


Presentation on theme: "JAX-RS – REST in Java. Copyright 2007 Tikal Knowledge, Ltd. | 2 | Agenda Introduction Compare to SOAP Server code Client code Frameworks."— Presentation transcript:

1 JAX-RS – REST in Java

2 Copyright 2007 Tikal Knowledge, Ltd. | 2 | Agenda Introduction Compare to SOAP Server code Client code Frameworks

3 Copyright 2007 Tikal Knowledge, Ltd. | 3 | Introduction Representational state transfer (Roy Fieding) Every URL represents an object or a state Who uses it? » Amazon AWS (EC2, S3, etc.) » Flickr » Del.ici.ous » Ebay CRUD by HTTP methods » Create POST » Read GET » Update PUT » Delete DELETE

4 Copyright 2007 Tikal Knowledge, Ltd. | 4 | Compare to SOAP REST advantages » Lightweight - not a lot of extra xml markup » Human Readable Results » Easy to build - no toolkits required SOAP advantages » Easy to consume – sometimes » Rigid - type checking, adheres to a contract » Development tools

5 Copyright 2007 Tikal Knowledge, Ltd. | 5 | Server code Servlet API » web.xml mapping » doGet, doPost, doUpdate, doDelete » Payload marshalling/unmarshalling » Example JSR-311 (JAX-RS) » Example

6 Copyright 2007 Tikal Knowledge, Ltd. | 6 | JAX-RS features Annotation based Deployment » JAX-RS aware container » javax.ws.rs.Application » Servlet container Servlet Filter » J2SE RuntimeDelegate.createEndpoint HTTP Data

7 Copyright 2007 Tikal Knowledge, Ltd. | 7 | JAX-RS HTTP Templated mapping and subresources MIME HTTP @HEAD, Caching » evaluatePreconditions

8 Copyright 2007 Tikal Knowledge, Ltd. | 8 | JAX RS data handling URI templates » {name} » {regex} Parameters » No annotation (entity) Return values » Resporse » GenericEntity » Null Status 204 » Entity (marshalled) Exceptions » WebApplicationException » Unchecked Filters, error pages » Checked ServletException, WebServiceException extends ExceptionMapper

9 Copyright 2007 Tikal Knowledge, Ltd. | 9 | Entities Primitives String enum byte [], File, DataSource, etc. JAXB valueOf List, Set, SortedSet – not worked for me » MessageBodyReader » MessageBodyWriter

10 Copyright 2007 Tikal Knowledge, Ltd. | 10 | Client code Old school – javascript, HttpClient REST oriented APIs » No standard spec » Framework offer good APIs org.jboss.resteasy.client.core com.sun.jersey.api.client

11 Copyright 2007 Tikal Knowledge, Ltd. | 11 | Frameworks Jboss resteasy Sun jersey CXF Axis2 Spring Others?

12 Copyright 2007 Tikal Knowledge, Ltd. | 12 | Q & A

13 Copyright 2007 Tikal Knowledge, Ltd. | 13 | Thank you


Download ppt "JAX-RS – REST in Java. Copyright 2007 Tikal Knowledge, Ltd. | 2 | Agenda Introduction Compare to SOAP Server code Client code Frameworks."

Similar presentations


Ads by Google