SlideShare ist ein Scribd-Unternehmen logo
1 von 59
Downloaden Sie, um offline zu lesen
JAX-RS
… and the REST will follow

         Guy Nir
Agenda

»   REST – What ? Who ? Why ?
»   JAX-RS (JSR-311) - Digg’n in
»   Security
»   Application-Level Protocol
»   Summary




                                   2
What ? Who ? Why ?
     … and how
What ? Who ? Why ?

Architectural overview

     GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/


                             HTTP request
                                                      Yahoo’s weather
    HTTP client                                         web-server
                            HTTP response

                  RESPONSE CODE: 200 (OK) + BODY




                                                                        4
What ? Who ? Why ?

Architectural overview

     GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/




    Read, The weather in Israel at Tel-Aviv area
                    (Ramat Gan).




                                                                       5
What ? Who ? Why ?

 HTTP request overview
GET /israel/tel-aviv/ramat-gan-1967869/ HTTP/1.1
Host: weather.yahoo.com
Accept: image/gif, application/xaml+xml, */*
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; ... )
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Cookie: BA=ba=2139&ip=82.80.99.106&t=1258874241;



        GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/

                             HTTP request              Yahoo’s weather
       HTTP client                                       web-server


                                                                          6
What ? Who ? Why ?

 HTTP request overview
GET /israel/tel-aviv/ramat-gan-1967869/ HTTP/1.1
Host: weather.yahoo.com
Accept: image/gif, application/xaml+xml, */*
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; ... )
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Cookie: BA=ba=2139&ip=82.80.99.106&t=1258874241;



        GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/

                             HTTP request              Yahoo’s weather
       HTTP client                                       web-server


                                                                          7
What ? Who ? Why ?

 HTTP request overview
GET /israel/tel-aviv/ramat-gan-1967869/ HTTP/1.1
Host: weather.yahoo.com
Accept: image/gif, text/plain, application/xml, */*
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; ... )
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Cookie: BA=ba=2139&ip=82.80.99.106&t=1258874241;



        GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/

                             HTTP request              Yahoo’s weather
       HTTP client                                       web-server


                                                                          8
What ? Who ? Why ?

 HTTP request overview
GET /israel/tel-aviv/ramat-gan-1967869/ HTTP/1.1
Host: weather.yahoo.com
Accept: image/gif, application/xaml+xml, */*
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; ... )
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Cookie: BA=2139&ip=82.80.99.106&t=1258874241;



        GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/

                             HTTP request              Yahoo’s weather
       HTTP client                                       web-server


                                                                          9
What ? Who ? Why ?

HTTP request overview

                         HTTP request               Yahoo’s weather
     HTTP client                                      web-server

                   RESPONSE CODE: 200 (OK) + BODY


HTTP/1.1 200 OK
Connection: close
Content-Type: text/html;charset=utf-8
Cache-Control: private
Content-Length: 69947
Date: Sun, 22 Nov 2009 07:59:11 GMT
Set-Cooie: t=164531234;


                                                                      10
What ? Who ? Why ?

HTTP request overview

                         HTTP request               Yahoo’s weather
     HTTP client                                      web-server

                   RESPONSE CODE: 200 (OK) + BODY


HTTP/1.1 200 OK
Connection: close
Content-Type: text/html;charset=utf-8
Cache-Control: private
Content-Length: 69947
Date: Sun, 22 Nov 2009 07:59:11 GMT
Set-Cooie: t=164531234;


                                                                      11
What ? Who ? Why ?

HTTP request overview

                         HTTP request               Yahoo’s weather
     HTTP client                                      web-server

                   RESPONSE CODE: 200 (OK) + BODY


HTTP/1.1 200 OK
Connection: close
Content-Type: text/html;charset=utf-8
Cache-Control: private
Content-Length: 69947
Date: Sun, 22 Nov 2009 07:59:11 GMT
Set-Cooie: t=164531234;


                                                                      12
What ? Who ? Why ?

HTTP request overview

                         HTTP request               Yahoo’s weather
     HTTP client                                      web-server

                   RESPONSE CODE: 200 (OK) + BODY


HTTP/1.1 200 OK
Connection: close
Content-Type: text/html;charset=utf-8
Cache-Control: private
Content-Length: 69947
Date: Sun, 22 Nov 2009 07:59:11 GMT
Set-Cooie: t=164531234;


                                                                      13
What ? Who ? Why ?

Everything is a resource …
» A resource is …
     A network-accessible data
      object or service identified by
                 [1]
      an URI (IRI ):
       • Images,
       • Documents (HTML, PDF, …),
       • Geo-location,
       • Weather
 [1] Section 3, Atom Publishing Protocol

                                           14
What ? Who ? Why ?

Resources:
» Collections
     http://portal/bicycles/




» Members/Items:
     http://portal/documents/mydog.doc

[1] Section 3, Atom Publishing Protocol

                                          15
What ? Who ? Why ?

HTTP defines more than just ‘GET’ and ‘POST’:
  Method              REST Operation    Description
  POST                CREATE (INSERT)   Create or update
  GET                 READ (QUERY)      Query about the resource
  PUT                 UPDATE (CHANGE) Update
  DELETE              DELETE (DELETE)   I want to delete what-ever-it-is ….
  HEAD                                  I’m something like ‘GET’ [1]
  OPTIONS                               JAX-RS mumbles something about me.
  TRACE
  CONNECT



[1] Unique extension of JAX-RS.

                                                                              16
What ? Who ? Why ?

Roy Fielding defines REST as:
» Free of any platform or language,
» Free of any schema or protocol (beyond that of HTTP),
» No ALP (Application- or Presentation- layer Protocol)
  coercion

                                                               [1]
» Only a set of recommendations !



[1] Principled Design of the Modern Web Architecture - Roy T. Fielding, Richard N. Taylor - section 4.

                                                                                                         17
What ? Who ? Why ?

Some important points …
» REST recommends using URIs instead of query-based
  URLs:
    Don’t use:
     http://host.com/service?type=weather&when=today
    Use:
     http://host.com/service/weather/today
» Atom Publishing Protocol (APP).
    RFC-5023 (text-only)



                                                       18
What ? Who ? Why ?

REST is …
» Architectural style, not technology !
      Client/server + Request/response approach.
»   Everything is a RESOURCE.
»   CRUD (Create / Read / Update / Delete) …        [1]



»   Stateless by nature (excellent for distributed systems),
»   Cacheable (naturally supported !)
»   A great way to web-service !

[1] Reference to other acronyms at Wikipedia

                                                               19
JAX-RS
JSR-311
JAX-RS (JSR-311)

JAX-RS goals[1]:
»   POJO-based,
»   HTTP-centric,
»   Format independent,
»   Container independent,
»   Availability as standalone and enterprise platforms.




[1] JSR-311, section 1.2 - Goals

                                                           21
JAX-RS (JSR-311)




                   HTTP JAX-RS




                                 22
JAX-RS (JSR-311)




This page is intentionally left blank




   Gesture for times when we used to read books ….


                                                     23
JAX-RS (JSR-311)


    http://www.disney.com/muppets/...




                                        24
JAX-RS (JSR-311)

POJO + Annotation = JAX-RS resource
/**
 * http://www.disney.com/muppets/catalog   Relative context
 */
@Path("/catalog")
public class MuppetCatalogController {

}




                                                              25
JAX-RS (JSR-311)

Reading the catalog
                         GET …/catalog
      CLIENT                                           SERVER
                  List all items available for sale.

/**
 * http://www.disney.com/muppets/catalog
 */
@Path("/catalog")
public class MuppetCatalogController {

    @GET
    public String findAllCatalogItems() {
        String list = ...     // Compile a list of all items.
        return list;
    }
}

                                                                26
JAX-RS (JSR-311)

Reading the catalog
                   GET …/catalog?muppetId=650
   CLIENT                                           SERVER
                       Properties of Kermit
public void doGet(HttpServletRequest req,
                  HttpServletResponse resp) throws ... {
    int muppetId;
    String stringId = req.getParameter("muppetId");
    if (stringId != null) {
        // Hoping for no exception to occur!
        muppetId = Integer.parseInt(stringId);
    } else {
        muppetId = ... // Use some default value …
    }
    Muppet muppet = findMuppet(muppetId);
    generateTextualOutput(muppet, resp.getWriter());
}
                                                             27
JAX-RS (JSR-311)

 URI template
                    GET …/catalog?muppetId=650
    CLIENT                                          SERVER
                        Properties of Kermit
@GET
@Path(“/catalog/{muppetId}”)
public String findItem(@QueryParam(“muppetId”)int muppedId) {
    Muppet muppet = findMuppet(muppetId);
    return ...
}




                                                                28
JAX-RS (JSR-311)

 URI template
                    GET …/catalog?muppetId=650
    CLIENT                                          SERVER
                        Properties of Kermit
@GET
@Path(“/catalog/{muppetId}”)
public String findItem(@DefaultValue(“0”)
                       @QueryParam(“muppetId”)int muppedId) {
    Muppet muppet = findMuppet(muppetId);
    return ...
}




                                                                29
JAX-RS (JSR-311)

 URI template
                        GET …/catalog/650
    CLIENT                                          SERVER
                        Properties of Kermit
@GET
@Path(“/catalog/{muppetId}”)
public String findItem(@PathParam(“muppetId”)int muppedId) {
    // ... Do something
}




                                                               30
JAX-RS (JSR-311)

 URI template
                        GET …/catalog/650
    CLIENT                                          SERVER
                        Properties of Kermit
@GET                                    Regular expression
@Path(“/catalog/{muppetId:[0-9]+}”)
public String findItem(@PathParam(“muppetId”)int muppedId) {
    // ... Do something
}




                                                               31
JAX-RS (JSR-311)

 URI template
                        GET …/catalog/650
    CLIENT                                          SERVER
                        Properties of Kermit
@GET
@Path(“/catalog/{muppetId:[0-9]+}”)
public String findItem(@PathParam(“muppetId”)int muppedId) {
    // ... Do something
}

// ACCEPT: http://.../catalog/-477
@GET
@Path(“/catalog/{muppetId:-[0-9]+}”)
public String findItem2(@PathParam(“muppetId”)int muppedId) {
    // ... Do something
}

                                                                32
JAX-RS (JSR-311)

Cookies, headers and friends …
                      Internet

           http://www.disney.com

             Public
                                   SERVER
             client

                                                     Intranet
GET   /muppet/catalog   HTTP/1.1
host: crm.intranet                      http://crm.intranet
accept: text/plain
User-Agent: Mozilla/4.0 (...)      Internal
                                    CRM
Cookie: user-type=ADMIN             client

                                                      Cookie

                                                                33
JAX-RS (JSR-311)

    Cookies, headers and friends …
@PUT
@Path("/catalog/{muppetId}/{propertyName}")
public void updateItem(
    @HeaderParam("host") String hostname,
    @CookieParam("user-type") UserType type, ...) {

      if (!hostname.equals("crm.intranet")) { throw ... }

      if (!UserType.CUSTOMER_CARE.equals(type)) { throw ... }

      // ... handle the request.
}

enum UserType { ADMIN, CUSTOMER_CARE, TECHNICAL; }



                                                                34
JAX-RS (JSR-311)

@Context
» UriInfo
» Request
» HttpHeaders
» SecurityContext


public void handleRequest(
    @Context UriInfo uri,
    @Context SecurityContext security,
    @QueryParam ("username") String username) { ... }

                                                        35
JAX-RS (JSR-311)

Content negotiation (or: cache is always money!)




                                                   36
JAX-RS (JSR-311)

 CLIENT                                            SERVER

      GET http://..../muppets/muppetOfTheMonth/image
                              +
             Content negotiation precondition




                        RESPONSE:
                         • 200 (OK) + body
                         • 304 (Not Modified)



                                                            37
JAX-RS (JSR-311)

    Content negotiation
@GET
@Path("/muppetOfTheMonth/image")
public Response findMuppetOfTheMonth(
    @Context UriInfo uri, @Context Request request) {

      File file = locateFile(uri.getRequestUri());
      EntityTag tag = calculateTag(file);
      Date modified = new Date(file.lastModified());

      ResponseBuilder r = request.evaluatePreconditions(modified,
                                                        tag);

      // ...
}



                                                               38
JAX-RS (JSR-311)

 The @HEAD method
                   HEAD …/catalog/650/image
     CLIENT                                   SERVER
              HTTP/1.1   200   OK
              Content-type: text/plain
              Content-length: 1024256




                                                       39
JAX-RS (JSR-311)

    The @HEAD method
@GET
@Path("/catalog/{muppetId}/image")
public Response fetchThumbnailHeadAndBody() {
    return ...;
}

@HEAD
@Path("/catalog/{muppetId}/image")
public Response fetchThumbnailHeadOnly(...) {
    int size = getThumbnailSize(muppetId);
    ResponseBuilder builder = Response.noContent();
    builder.header("Content-length", size);
    builder.header(“Is-ReadOnly", true);

    return builder.build();
{

                                                      40
JAX-RS (JSR-311)

Bridging between the two worlds ….


    HTTP                                                                                 Java

                        MessageBodyReader




                                                                          MessageBodyWriter
The Millau Viaduct bridge, part E11 highway - connecting Paris and Barcelona. The highest bridge ever
constructed.

                                                                                                        41
JAX-RS (JSR-311)

Providers:
» Provides adaptation between the “HTTP world” and
  our own application domain:
   MessageBodyReader,
   MessageBodyWriter
                                     Java object
 HTTP Request
                 MessageBodyReader
                                                   Resource class
                 MessageBodyWriter
 HTTP Response



                                                                    42
JAX-RS (JSR-311)

@Path("users/{id}/properties")
public class UserPropertiesResource {

    @GET
    @Produces(“application/json")
    public User findUser(@PathParam("id") int userId) {
        return userDao.getUser(userId);
    {

    @GET
    @Produces(“application/atom+xml")
    public User findUser(@PathParam("id") int userId) { ... }

    @POST
    public void findUser(User user) {
        userDao.persist(user);
    }
{

                                                            43
JAX-RS (JSR-311)

@Provider
     @Path("users/{id}/properties")
@Produces("application/json")
public classclass UserPropertiesResource {
     public JSONWriter implements MessageBodyWriter<User> {

@Override@GET
         @Produces(“application/json")
public long getSize(User user, ...) {
         public User findUser(@PathParam("id") int userId) {
    return JSON.toString(user).length();
{            // ...
         {
@Override
         @POST
public boolean isWriteable(java.lang.Class<?> type, ...) {
    return User.class.equals(type);user) {
         public void findUser(User
{            // ...
         }
     {
@Override
public void writeTo(User user, ... OutputStream out) {
    JSON.write(user, out);
{

                                                               44
45
JAX-RS (JSR-311)

Leading JAX-RS implementations
» Glassfish Jersey project (Sun Microsystems),
    https://jersey.dev.java.net/
» RESTEasy (JBoss),
    http://www.jboss.org/resteasy/
» Apache CXF (Apache Software Foundation),
    http://cxf.apache.org/
» Wink (ASF incubation project),
    http://incubator.apache.org/wink/
» Restlet (Noelios Technologies).
    http://www.restlet.org/


                                                 46
Security
(lack of …)
Security

Security
» Authentication
    Who’s calling ?
» Authorization
    What am I allowed to do ?
» Content delivery:
    Integrity,
    Confidentiality,
    Authentication.



                                 48
Security

Security
» Authentication
    Who’s calling ?
» Authorization
    What am I allowed to do ?
» Content delivery:
    Integrity,
    Confidentiality,
    Authentication.



                                 49
Security

Security
» Authentication
    Who’s calling ?
» Authorization
    What am I allowed to do ?
» Content delivery:
    Integrity,
    Confidentiality,
    Authentication.



                                 50
Application-Level Protocols
    Marshalling REST data
Content deliver

Suggestions:
»   Proprietary (custom made) solution,
»   Hessian binary web-service protocol (Caucho),
»   Burlap XML-based web-service protocol (Caucho),
»   Avro / Buffers protocol,
»   JSON (JavaScript Object Notion),
»   Protocol Buffers (by Google) ,
»   Kyro (only for hard-core programmers)


                                                      52
Content deliver

Proprietary (custom made) solution
» When we have a really simple format:
    Short-message strings,
    Single result objects
» Specific binary format,
    Multimedia (Images, Movies, etc…),
    Proprietary protocol.
» Bound to certain technology:
    JAXB, DOM-based (JAXP),
    Java native (binary) serialization.

                                           53
Content deliver

Hessian binary web-service protocol
» Binary, compact format.
» Very lightweight,
    Extremely suitable to mobile or other limited devices.
    Provide J2ME libraries.
» No external IDL or schema,
» Language independent,
» Support for compression, encryption, signatures (with
  partial external support).


                                                              54
Content deliver

Burlap XML-based web-service protocol
» Minimal XML-based format,
» Very lightweight (considering XML format),
    Provide J2ME libraries.
» No external IDL or schema,
» Language independent (as XML is !),
» Suffice to operate EJB –
    Cell phone -> Burlap -> RESTEasy -> EJB !



                                                 55
Content deliver

Avro serialization stack
» Part of Hadoop stack,
» Lightweight, but not as the other protocols.
» Requires schema:
    Pluggable architecture to support multiple formats (JSON,
     XML, etc …)
» Dynamic typing (very reach with its support),
» Untagged data.



                                                                 56
Summary


» REST is a simple WS.
» JAX-RS is a reflection of the HTTP world.
    Using Java-5 annotations only.
» Lack of concrete security model.




                                              57
Q&A
Thank you !!!
Applause now !

Weitere ähnliche Inhalte

Was ist angesagt?

How Machine Learning and AI Can Support the Fight Against COVID-19
How Machine Learning and AI Can Support the Fight Against COVID-19How Machine Learning and AI Can Support the Fight Against COVID-19
How Machine Learning and AI Can Support the Fight Against COVID-19Databricks
 
Integrating Deep Learning Libraries with Apache Spark
Integrating Deep Learning Libraries with Apache SparkIntegrating Deep Learning Libraries with Apache Spark
Integrating Deep Learning Libraries with Apache SparkDatabricks
 
Deep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache SparkDeep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache SparkDatabricks
 
BDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part IIBDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part IIDavid Lauzon
 
Java Performance and Profiling
Java Performance and ProfilingJava Performance and Profiling
Java Performance and ProfilingWSO2
 
Writing Continuous Applications with Structured Streaming Python APIs in Apac...
Writing Continuous Applications with Structured Streaming Python APIs in Apac...Writing Continuous Applications with Structured Streaming Python APIs in Apac...
Writing Continuous Applications with Structured Streaming Python APIs in Apac...Databricks
 
Scaling Spark Workloads on YARN - Boulder/Denver July 2015
Scaling Spark Workloads on YARN - Boulder/Denver July 2015Scaling Spark Workloads on YARN - Boulder/Denver July 2015
Scaling Spark Workloads on YARN - Boulder/Denver July 2015Mac Moore
 
Speeding Up Spark with Data Compression on Xeon+FPGA with David Ojika
Speeding Up Spark with Data Compression on Xeon+FPGA with David OjikaSpeeding Up Spark with Data Compression on Xeon+FPGA with David Ojika
Speeding Up Spark with Data Compression on Xeon+FPGA with David OjikaDatabricks
 
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)jaxLondonConference
 
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph DatabaseBringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph DatabaseJimmy Angelakos
 
Spark & Spark Streaming Internals - Nov 15 (1)
Spark & Spark Streaming Internals - Nov 15 (1)Spark & Spark Streaming Internals - Nov 15 (1)
Spark & Spark Streaming Internals - Nov 15 (1)Akhil Das
 
Improving PySpark performance: Spark Performance Beyond the JVM
Improving PySpark performance: Spark Performance Beyond the JVMImproving PySpark performance: Spark Performance Beyond the JVM
Improving PySpark performance: Spark Performance Beyond the JVMHolden Karau
 
Apache Spark: What's under the hood
Apache Spark: What's under the hoodApache Spark: What's under the hood
Apache Spark: What's under the hoodAdarsh Pannu
 
Deep Learning: DL4J and DataVec
Deep Learning: DL4J and DataVecDeep Learning: DL4J and DataVec
Deep Learning: DL4J and DataVecJosh Patterson
 
ACES QuakeSim 2011
ACES QuakeSim 2011ACES QuakeSim 2011
ACES QuakeSim 2011marpierc
 
Using PostgreSQL with Bibliographic Data
Using PostgreSQL with Bibliographic DataUsing PostgreSQL with Bibliographic Data
Using PostgreSQL with Bibliographic DataJimmy Angelakos
 
Yarn 3.1 and Beyond in ApacheCon North America 2018
Yarn 3.1 and Beyond in ApacheCon North America 2018Yarn 3.1 and Beyond in ApacheCon North America 2018
Yarn 3.1 and Beyond in ApacheCon North America 2018Naganarasimha Garla
 
Getting The Best Performance With PySpark
Getting The Best Performance With PySparkGetting The Best Performance With PySpark
Getting The Best Performance With PySparkSpark Summit
 
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.J On The Beach
 

Was ist angesagt? (20)

How Machine Learning and AI Can Support the Fight Against COVID-19
How Machine Learning and AI Can Support the Fight Against COVID-19How Machine Learning and AI Can Support the Fight Against COVID-19
How Machine Learning and AI Can Support the Fight Against COVID-19
 
Integrating Deep Learning Libraries with Apache Spark
Integrating Deep Learning Libraries with Apache SparkIntegrating Deep Learning Libraries with Apache Spark
Integrating Deep Learning Libraries with Apache Spark
 
Deep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache SparkDeep Dive: Memory Management in Apache Spark
Deep Dive: Memory Management in Apache Spark
 
BDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part IIBDM32: AdamCloud Project - Part II
BDM32: AdamCloud Project - Part II
 
Java Performance and Profiling
Java Performance and ProfilingJava Performance and Profiling
Java Performance and Profiling
 
Writing Continuous Applications with Structured Streaming Python APIs in Apac...
Writing Continuous Applications with Structured Streaming Python APIs in Apac...Writing Continuous Applications with Structured Streaming Python APIs in Apac...
Writing Continuous Applications with Structured Streaming Python APIs in Apac...
 
Scaling Spark Workloads on YARN - Boulder/Denver July 2015
Scaling Spark Workloads on YARN - Boulder/Denver July 2015Scaling Spark Workloads on YARN - Boulder/Denver July 2015
Scaling Spark Workloads on YARN - Boulder/Denver July 2015
 
Speeding Up Spark with Data Compression on Xeon+FPGA with David Ojika
Speeding Up Spark with Data Compression on Xeon+FPGA with David OjikaSpeeding Up Spark with Data Compression on Xeon+FPGA with David Ojika
Speeding Up Spark with Data Compression on Xeon+FPGA with David Ojika
 
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
 
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph DatabaseBringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
 
Spark & Spark Streaming Internals - Nov 15 (1)
Spark & Spark Streaming Internals - Nov 15 (1)Spark & Spark Streaming Internals - Nov 15 (1)
Spark & Spark Streaming Internals - Nov 15 (1)
 
Improving PySpark performance: Spark Performance Beyond the JVM
Improving PySpark performance: Spark Performance Beyond the JVMImproving PySpark performance: Spark Performance Beyond the JVM
Improving PySpark performance: Spark Performance Beyond the JVM
 
Apache Spark: What's under the hood
Apache Spark: What's under the hoodApache Spark: What's under the hood
Apache Spark: What's under the hood
 
Deep Learning: DL4J and DataVec
Deep Learning: DL4J and DataVecDeep Learning: DL4J and DataVec
Deep Learning: DL4J and DataVec
 
ACES QuakeSim 2011
ACES QuakeSim 2011ACES QuakeSim 2011
ACES QuakeSim 2011
 
Using PostgreSQL with Bibliographic Data
Using PostgreSQL with Bibliographic DataUsing PostgreSQL with Bibliographic Data
Using PostgreSQL with Bibliographic Data
 
Yarn 3.1 and Beyond in ApacheCon North America 2018
Yarn 3.1 and Beyond in ApacheCon North America 2018Yarn 3.1 and Beyond in ApacheCon North America 2018
Yarn 3.1 and Beyond in ApacheCon North America 2018
 
Spark 101
Spark 101Spark 101
Spark 101
 
Getting The Best Performance With PySpark
Getting The Best Performance With PySparkGetting The Best Performance With PySpark
Getting The Best Performance With PySpark
 
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
A Java Implementer's Guide to Boosting Apache Spark Performance by Tim Ellison.
 

Andere mochten auch

Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsGuy Nir
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVCGuy Nir
 
Tworzenie list zainteresowań na Facebooku i Twitterze
Tworzenie list zainteresowań na Facebooku i TwitterzeTworzenie list zainteresowań na Facebooku i Twitterze
Tworzenie list zainteresowań na Facebooku i TwitterzeŁukasz Dębski
 
Ramowanie w telewizyjnej reklamie politycznej
Ramowanie w telewizyjnej reklamie politycznejRamowanie w telewizyjnej reklamie politycznej
Ramowanie w telewizyjnej reklamie politycznejTomasz Olczyk
 
Decyzje w pracy menedzera (kierownika). Aleksander Sosnowski
Decyzje w pracy menedzera (kierownika). Aleksander SosnowskiDecyzje w pracy menedzera (kierownika). Aleksander Sosnowski
Decyzje w pracy menedzera (kierownika). Aleksander SosnowskiAleksander Sosnowski
 
Netflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at GlueconNetflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at GlueconAdrian Cockcroft
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 

Andere mochten auch (10)

Kpk
KpkKpk
Kpk
 
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
 
Tworzenie list zainteresowań na Facebooku i Twitterze
Tworzenie list zainteresowań na Facebooku i TwitterzeTworzenie list zainteresowań na Facebooku i Twitterze
Tworzenie list zainteresowań na Facebooku i Twitterze
 
Ramowanie w telewizyjnej reklamie politycznej
Ramowanie w telewizyjnej reklamie politycznejRamowanie w telewizyjnej reklamie politycznej
Ramowanie w telewizyjnej reklamie politycznej
 
KBO - wnioski na 2017
KBO - wnioski na 2017KBO - wnioski na 2017
KBO - wnioski na 2017
 
Decyzje w pracy menedzera (kierownika). Aleksander Sosnowski
Decyzje w pracy menedzera (kierownika). Aleksander SosnowskiDecyzje w pracy menedzera (kierownika). Aleksander Sosnowski
Decyzje w pracy menedzera (kierownika). Aleksander Sosnowski
 
Netflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at GlueconNetflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at Gluecon
 
Z1.03
Z1.03Z1.03
Z1.03
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 

Ähnlich wie REST and JAX-RS

IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."Dongwook Lee
 
Type URL, Enter, and Then …
Type URL, Enter, and Then …Type URL, Enter, and Then …
Type URL, Enter, and Then …Jinglun Li
 
20190516 web security-basic
20190516 web security-basic20190516 web security-basic
20190516 web security-basicMksYi
 
OWASP Top 10 - Checkmarx Presentation at Polytechnic Institute of Cávado and Ave
OWASP Top 10 - Checkmarx Presentation at Polytechnic Institute of Cávado and AveOWASP Top 10 - Checkmarx Presentation at Polytechnic Institute of Cávado and Ave
OWASP Top 10 - Checkmarx Presentation at Polytechnic Institute of Cávado and AveCheckmarx
 
Improving performance by changing the rules from fast to SPDY
Improving performance by changing the rules   from fast to SPDYImproving performance by changing the rules   from fast to SPDY
Improving performance by changing the rules from fast to SPDYCotendo
 
From Fast To SPDY
From Fast To SPDYFrom Fast To SPDY
From Fast To SPDYMike Belshe
 
rest3d Web3D 2014
rest3d Web3D 2014rest3d Web3D 2014
rest3d Web3D 2014Remi Arnaud
 
Tuning web performance
Tuning web performanceTuning web performance
Tuning web performanceGeorge Ang
 
Tuning Web Performance
Tuning Web PerformanceTuning Web Performance
Tuning Web PerformanceEric ShangKuan
 
Presentation (PowerPoint File)
Presentation (PowerPoint File)Presentation (PowerPoint File)
Presentation (PowerPoint File)webhostingguy
 
Presentation (PowerPoint File)
Presentation (PowerPoint File)Presentation (PowerPoint File)
Presentation (PowerPoint File)webhostingguy
 
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)Carles Farré
 
HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?Alessandro Nadalin
 
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011Vlad Savitsky
 
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атакСтек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атакPositive Hack Days
 

Ähnlich wie REST and JAX-RS (20)

IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
IBM dwLive, "Internet & HTTP - 잃어버린 패킷을 찾아서..."
 
Type URL, Enter, and Then …
Type URL, Enter, and Then …Type URL, Enter, and Then …
Type URL, Enter, and Then …
 
20190516 web security-basic
20190516 web security-basic20190516 web security-basic
20190516 web security-basic
 
OWASP Top 10 - Checkmarx Presentation at Polytechnic Institute of Cávado and Ave
OWASP Top 10 - Checkmarx Presentation at Polytechnic Institute of Cávado and AveOWASP Top 10 - Checkmarx Presentation at Polytechnic Institute of Cávado and Ave
OWASP Top 10 - Checkmarx Presentation at Polytechnic Institute of Cávado and Ave
 
RESTful OGC Services
RESTful OGC ServicesRESTful OGC Services
RESTful OGC Services
 
Improving performance by changing the rules from fast to SPDY
Improving performance by changing the rules   from fast to SPDYImproving performance by changing the rules   from fast to SPDY
Improving performance by changing the rules from fast to SPDY
 
From Fast To SPDY
From Fast To SPDYFrom Fast To SPDY
From Fast To SPDY
 
rest3d Web3D 2014
rest3d Web3D 2014rest3d Web3D 2014
rest3d Web3D 2014
 
Tuning web performance
Tuning web performanceTuning web performance
Tuning web performance
 
Tuning Web Performance
Tuning Web PerformanceTuning Web Performance
Tuning Web Performance
 
Presentation (PowerPoint File)
Presentation (PowerPoint File)Presentation (PowerPoint File)
Presentation (PowerPoint File)
 
Presentation (PowerPoint File)
Presentation (PowerPoint File)Presentation (PowerPoint File)
Presentation (PowerPoint File)
 
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
 
Browser Security
Browser SecurityBrowser Security
Browser Security
 
HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?HTTP colon slash slash: the end of the road?
HTTP colon slash slash: the end of the road?
 
Http2 kotlin
Http2   kotlinHttp2   kotlin
Http2 kotlin
 
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
 
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атакСтек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
 
Introduction HTTP via cURL
Introduction HTTP via cURLIntroduction HTTP via cURL
Introduction HTTP via cURL
 
WWW and HTTP
WWW and HTTPWWW and HTTP
WWW and HTTP
 

Kürzlich hochgeladen

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
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
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Kürzlich hochgeladen (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
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.
 
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
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 

REST and JAX-RS

  • 1. JAX-RS … and the REST will follow Guy Nir
  • 2. Agenda » REST – What ? Who ? Why ? » JAX-RS (JSR-311) - Digg’n in » Security » Application-Level Protocol » Summary 2
  • 3. What ? Who ? Why ? … and how
  • 4. What ? Who ? Why ? Architectural overview GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/ HTTP request Yahoo’s weather HTTP client web-server HTTP response RESPONSE CODE: 200 (OK) + BODY 4
  • 5. What ? Who ? Why ? Architectural overview GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/ Read, The weather in Israel at Tel-Aviv area (Ramat Gan). 5
  • 6. What ? Who ? Why ? HTTP request overview GET /israel/tel-aviv/ramat-gan-1967869/ HTTP/1.1 Host: weather.yahoo.com Accept: image/gif, application/xaml+xml, */* Accept-Language: en-us User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; ... ) Accept-Encoding: gzip, deflate Connection: Keep-Alive Cookie: BA=ba=2139&ip=82.80.99.106&t=1258874241; GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/ HTTP request Yahoo’s weather HTTP client web-server 6
  • 7. What ? Who ? Why ? HTTP request overview GET /israel/tel-aviv/ramat-gan-1967869/ HTTP/1.1 Host: weather.yahoo.com Accept: image/gif, application/xaml+xml, */* Accept-Language: en-us User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; ... ) Accept-Encoding: gzip, deflate Connection: Keep-Alive Cookie: BA=ba=2139&ip=82.80.99.106&t=1258874241; GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/ HTTP request Yahoo’s weather HTTP client web-server 7
  • 8. What ? Who ? Why ? HTTP request overview GET /israel/tel-aviv/ramat-gan-1967869/ HTTP/1.1 Host: weather.yahoo.com Accept: image/gif, text/plain, application/xml, */* Accept-Language: en-us User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; ... ) Accept-Encoding: gzip, deflate Connection: Keep-Alive Cookie: BA=ba=2139&ip=82.80.99.106&t=1258874241; GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/ HTTP request Yahoo’s weather HTTP client web-server 8
  • 9. What ? Who ? Why ? HTTP request overview GET /israel/tel-aviv/ramat-gan-1967869/ HTTP/1.1 Host: weather.yahoo.com Accept: image/gif, application/xaml+xml, */* Accept-Language: en-us User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; ... ) Accept-Encoding: gzip, deflate Connection: Keep-Alive Cookie: BA=2139&ip=82.80.99.106&t=1258874241; GET http://weather.yahoo.com/israel/tel-aviv/ramat-gan-1967869/ HTTP request Yahoo’s weather HTTP client web-server 9
  • 10. What ? Who ? Why ? HTTP request overview HTTP request Yahoo’s weather HTTP client web-server RESPONSE CODE: 200 (OK) + BODY HTTP/1.1 200 OK Connection: close Content-Type: text/html;charset=utf-8 Cache-Control: private Content-Length: 69947 Date: Sun, 22 Nov 2009 07:59:11 GMT Set-Cooie: t=164531234; 10
  • 11. What ? Who ? Why ? HTTP request overview HTTP request Yahoo’s weather HTTP client web-server RESPONSE CODE: 200 (OK) + BODY HTTP/1.1 200 OK Connection: close Content-Type: text/html;charset=utf-8 Cache-Control: private Content-Length: 69947 Date: Sun, 22 Nov 2009 07:59:11 GMT Set-Cooie: t=164531234; 11
  • 12. What ? Who ? Why ? HTTP request overview HTTP request Yahoo’s weather HTTP client web-server RESPONSE CODE: 200 (OK) + BODY HTTP/1.1 200 OK Connection: close Content-Type: text/html;charset=utf-8 Cache-Control: private Content-Length: 69947 Date: Sun, 22 Nov 2009 07:59:11 GMT Set-Cooie: t=164531234; 12
  • 13. What ? Who ? Why ? HTTP request overview HTTP request Yahoo’s weather HTTP client web-server RESPONSE CODE: 200 (OK) + BODY HTTP/1.1 200 OK Connection: close Content-Type: text/html;charset=utf-8 Cache-Control: private Content-Length: 69947 Date: Sun, 22 Nov 2009 07:59:11 GMT Set-Cooie: t=164531234; 13
  • 14. What ? Who ? Why ? Everything is a resource … » A resource is …  A network-accessible data object or service identified by [1] an URI (IRI ): • Images, • Documents (HTML, PDF, …), • Geo-location, • Weather [1] Section 3, Atom Publishing Protocol 14
  • 15. What ? Who ? Why ? Resources: » Collections  http://portal/bicycles/ » Members/Items:  http://portal/documents/mydog.doc [1] Section 3, Atom Publishing Protocol 15
  • 16. What ? Who ? Why ? HTTP defines more than just ‘GET’ and ‘POST’: Method REST Operation Description POST CREATE (INSERT) Create or update GET READ (QUERY) Query about the resource PUT UPDATE (CHANGE) Update DELETE DELETE (DELETE) I want to delete what-ever-it-is …. HEAD I’m something like ‘GET’ [1] OPTIONS JAX-RS mumbles something about me. TRACE CONNECT [1] Unique extension of JAX-RS. 16
  • 17. What ? Who ? Why ? Roy Fielding defines REST as: » Free of any platform or language, » Free of any schema or protocol (beyond that of HTTP), » No ALP (Application- or Presentation- layer Protocol) coercion [1] » Only a set of recommendations ! [1] Principled Design of the Modern Web Architecture - Roy T. Fielding, Richard N. Taylor - section 4. 17
  • 18. What ? Who ? Why ? Some important points … » REST recommends using URIs instead of query-based URLs:  Don’t use: http://host.com/service?type=weather&when=today  Use: http://host.com/service/weather/today » Atom Publishing Protocol (APP).  RFC-5023 (text-only) 18
  • 19. What ? Who ? Why ? REST is … » Architectural style, not technology !  Client/server + Request/response approach. » Everything is a RESOURCE. » CRUD (Create / Read / Update / Delete) … [1] » Stateless by nature (excellent for distributed systems), » Cacheable (naturally supported !) » A great way to web-service ! [1] Reference to other acronyms at Wikipedia 19
  • 21. JAX-RS (JSR-311) JAX-RS goals[1]: » POJO-based, » HTTP-centric, » Format independent, » Container independent, » Availability as standalone and enterprise platforms. [1] JSR-311, section 1.2 - Goals 21
  • 22. JAX-RS (JSR-311) HTTP JAX-RS 22
  • 23. JAX-RS (JSR-311) This page is intentionally left blank Gesture for times when we used to read books …. 23
  • 24. JAX-RS (JSR-311) http://www.disney.com/muppets/... 24
  • 25. JAX-RS (JSR-311) POJO + Annotation = JAX-RS resource /** * http://www.disney.com/muppets/catalog Relative context */ @Path("/catalog") public class MuppetCatalogController { } 25
  • 26. JAX-RS (JSR-311) Reading the catalog GET …/catalog CLIENT SERVER List all items available for sale. /** * http://www.disney.com/muppets/catalog */ @Path("/catalog") public class MuppetCatalogController { @GET public String findAllCatalogItems() { String list = ... // Compile a list of all items. return list; } } 26
  • 27. JAX-RS (JSR-311) Reading the catalog GET …/catalog?muppetId=650 CLIENT SERVER Properties of Kermit public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ... { int muppetId; String stringId = req.getParameter("muppetId"); if (stringId != null) { // Hoping for no exception to occur! muppetId = Integer.parseInt(stringId); } else { muppetId = ... // Use some default value … } Muppet muppet = findMuppet(muppetId); generateTextualOutput(muppet, resp.getWriter()); } 27
  • 28. JAX-RS (JSR-311) URI template GET …/catalog?muppetId=650 CLIENT SERVER Properties of Kermit @GET @Path(“/catalog/{muppetId}”) public String findItem(@QueryParam(“muppetId”)int muppedId) { Muppet muppet = findMuppet(muppetId); return ... } 28
  • 29. JAX-RS (JSR-311) URI template GET …/catalog?muppetId=650 CLIENT SERVER Properties of Kermit @GET @Path(“/catalog/{muppetId}”) public String findItem(@DefaultValue(“0”) @QueryParam(“muppetId”)int muppedId) { Muppet muppet = findMuppet(muppetId); return ... } 29
  • 30. JAX-RS (JSR-311) URI template GET …/catalog/650 CLIENT SERVER Properties of Kermit @GET @Path(“/catalog/{muppetId}”) public String findItem(@PathParam(“muppetId”)int muppedId) { // ... Do something } 30
  • 31. JAX-RS (JSR-311) URI template GET …/catalog/650 CLIENT SERVER Properties of Kermit @GET Regular expression @Path(“/catalog/{muppetId:[0-9]+}”) public String findItem(@PathParam(“muppetId”)int muppedId) { // ... Do something } 31
  • 32. JAX-RS (JSR-311) URI template GET …/catalog/650 CLIENT SERVER Properties of Kermit @GET @Path(“/catalog/{muppetId:[0-9]+}”) public String findItem(@PathParam(“muppetId”)int muppedId) { // ... Do something } // ACCEPT: http://.../catalog/-477 @GET @Path(“/catalog/{muppetId:-[0-9]+}”) public String findItem2(@PathParam(“muppetId”)int muppedId) { // ... Do something } 32
  • 33. JAX-RS (JSR-311) Cookies, headers and friends … Internet http://www.disney.com Public SERVER client Intranet GET /muppet/catalog HTTP/1.1 host: crm.intranet http://crm.intranet accept: text/plain User-Agent: Mozilla/4.0 (...) Internal CRM Cookie: user-type=ADMIN client Cookie 33
  • 34. JAX-RS (JSR-311) Cookies, headers and friends … @PUT @Path("/catalog/{muppetId}/{propertyName}") public void updateItem( @HeaderParam("host") String hostname, @CookieParam("user-type") UserType type, ...) { if (!hostname.equals("crm.intranet")) { throw ... } if (!UserType.CUSTOMER_CARE.equals(type)) { throw ... } // ... handle the request. } enum UserType { ADMIN, CUSTOMER_CARE, TECHNICAL; } 34
  • 35. JAX-RS (JSR-311) @Context » UriInfo » Request » HttpHeaders » SecurityContext public void handleRequest( @Context UriInfo uri, @Context SecurityContext security, @QueryParam ("username") String username) { ... } 35
  • 36. JAX-RS (JSR-311) Content negotiation (or: cache is always money!) 36
  • 37. JAX-RS (JSR-311) CLIENT SERVER GET http://..../muppets/muppetOfTheMonth/image + Content negotiation precondition RESPONSE: • 200 (OK) + body • 304 (Not Modified) 37
  • 38. JAX-RS (JSR-311) Content negotiation @GET @Path("/muppetOfTheMonth/image") public Response findMuppetOfTheMonth( @Context UriInfo uri, @Context Request request) { File file = locateFile(uri.getRequestUri()); EntityTag tag = calculateTag(file); Date modified = new Date(file.lastModified()); ResponseBuilder r = request.evaluatePreconditions(modified, tag); // ... } 38
  • 39. JAX-RS (JSR-311) The @HEAD method HEAD …/catalog/650/image CLIENT SERVER HTTP/1.1 200 OK Content-type: text/plain Content-length: 1024256 39
  • 40. JAX-RS (JSR-311) The @HEAD method @GET @Path("/catalog/{muppetId}/image") public Response fetchThumbnailHeadAndBody() { return ...; } @HEAD @Path("/catalog/{muppetId}/image") public Response fetchThumbnailHeadOnly(...) { int size = getThumbnailSize(muppetId); ResponseBuilder builder = Response.noContent(); builder.header("Content-length", size); builder.header(“Is-ReadOnly", true); return builder.build(); { 40
  • 41. JAX-RS (JSR-311) Bridging between the two worlds …. HTTP Java MessageBodyReader MessageBodyWriter The Millau Viaduct bridge, part E11 highway - connecting Paris and Barcelona. The highest bridge ever constructed. 41
  • 42. JAX-RS (JSR-311) Providers: » Provides adaptation between the “HTTP world” and our own application domain:  MessageBodyReader,  MessageBodyWriter Java object HTTP Request MessageBodyReader Resource class MessageBodyWriter HTTP Response 42
  • 43. JAX-RS (JSR-311) @Path("users/{id}/properties") public class UserPropertiesResource { @GET @Produces(“application/json") public User findUser(@PathParam("id") int userId) { return userDao.getUser(userId); { @GET @Produces(“application/atom+xml") public User findUser(@PathParam("id") int userId) { ... } @POST public void findUser(User user) { userDao.persist(user); } { 43
  • 44. JAX-RS (JSR-311) @Provider @Path("users/{id}/properties") @Produces("application/json") public classclass UserPropertiesResource { public JSONWriter implements MessageBodyWriter<User> { @Override@GET @Produces(“application/json") public long getSize(User user, ...) { public User findUser(@PathParam("id") int userId) { return JSON.toString(user).length(); { // ... { @Override @POST public boolean isWriteable(java.lang.Class<?> type, ...) { return User.class.equals(type);user) { public void findUser(User { // ... } { @Override public void writeTo(User user, ... OutputStream out) { JSON.write(user, out); { 44
  • 45. 45
  • 46. JAX-RS (JSR-311) Leading JAX-RS implementations » Glassfish Jersey project (Sun Microsystems),  https://jersey.dev.java.net/ » RESTEasy (JBoss),  http://www.jboss.org/resteasy/ » Apache CXF (Apache Software Foundation),  http://cxf.apache.org/ » Wink (ASF incubation project),  http://incubator.apache.org/wink/ » Restlet (Noelios Technologies).  http://www.restlet.org/ 46
  • 48. Security Security » Authentication  Who’s calling ? » Authorization  What am I allowed to do ? » Content delivery:  Integrity,  Confidentiality,  Authentication. 48
  • 49. Security Security » Authentication  Who’s calling ? » Authorization  What am I allowed to do ? » Content delivery:  Integrity,  Confidentiality,  Authentication. 49
  • 50. Security Security » Authentication  Who’s calling ? » Authorization  What am I allowed to do ? » Content delivery:  Integrity,  Confidentiality,  Authentication. 50
  • 51. Application-Level Protocols Marshalling REST data
  • 52. Content deliver Suggestions: » Proprietary (custom made) solution, » Hessian binary web-service protocol (Caucho), » Burlap XML-based web-service protocol (Caucho), » Avro / Buffers protocol, » JSON (JavaScript Object Notion), » Protocol Buffers (by Google) , » Kyro (only for hard-core programmers) 52
  • 53. Content deliver Proprietary (custom made) solution » When we have a really simple format:  Short-message strings,  Single result objects » Specific binary format,  Multimedia (Images, Movies, etc…),  Proprietary protocol. » Bound to certain technology:  JAXB, DOM-based (JAXP),  Java native (binary) serialization. 53
  • 54. Content deliver Hessian binary web-service protocol » Binary, compact format. » Very lightweight,  Extremely suitable to mobile or other limited devices.  Provide J2ME libraries. » No external IDL or schema, » Language independent, » Support for compression, encryption, signatures (with partial external support). 54
  • 55. Content deliver Burlap XML-based web-service protocol » Minimal XML-based format, » Very lightweight (considering XML format),  Provide J2ME libraries. » No external IDL or schema, » Language independent (as XML is !), » Suffice to operate EJB –  Cell phone -> Burlap -> RESTEasy -> EJB ! 55
  • 56. Content deliver Avro serialization stack » Part of Hadoop stack, » Lightweight, but not as the other protocols. » Requires schema:  Pluggable architecture to support multiple formats (JSON, XML, etc …) » Dynamic typing (very reach with its support), » Untagged data. 56
  • 57. Summary » REST is a simple WS. » JAX-RS is a reflection of the HTTP world.  Using Java-5 annotations only. » Lack of concrete security model. 57
  • 58. Q&A