SlideShare a Scribd company logo
1 of 51
Download to read offline
JAX-RS 2.0: RESTful Java on Steroids
Arun Gupta, Java EE & GlassFish Guy
http://blogs.oracle.com/arungupta, @arungupta
 1   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
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 © 2012, Oracle and/or its affiliates. All rights reserved.
                2011,
Part I: How we got here ?




3   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
How We Got Here?

    •  Shortest intro to JAX-RS 1.0
    •  Requested features for JAX-RS 2.0
    •  JSR 339: JAX-RS 2.0




4   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
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 communications



5   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JAX-RS 1.0 Goals

    •  POJO-Based API
    •  HTTP Centric
    •  Format Independence
    •  Container Independence
    •  Inclusion in Java EE




6   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: JAX-RS API
                                                                                     Resources


@Path("/atm/{cardId}")	                                    URI Parameter
public 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 © 2012, Oracle and/or its affiliates. All rights reserved.
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 © 2012, Oracle and/or its affiliates. All rights reserved.
Example: JAX-RS API (contd.)




9   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: JAX-RS API (contd.)




10   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Requested Features

     •  Client API
     •  Client-side and Server-side Asynchronous
     •  Filters and Interceptors
     •  Improved Connection Negotiation
     •  Validation
     •  Hypermedia
     •  Alignment with JSR 330
     •  Model-View-Controller
11   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
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 3 published on Jun 7, 2012!


12   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Part II: Where We Are Going




13   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
In-Scope Features

     •  Client API
     •  Filters and Interceptors
     •  Client-side and Server-side Asynchronous
     •  Improved Connection Negotiation
     •  Validation
     •  Hypermedia
     •  Alignment with JSR 330
     •  Model-View-Controller
14   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
New in JAX-RS 2.0

     •  Client API
     •  Filters and Interceptors
     •  Client-side and Server-side Asynchronous
     •  Improved Connection Negotiation
     •  Validation
     •  Hypermedia
     •  Alignment with JSR 330


15   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Client API - 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 standard




16   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Client API – Old and New

     •  Client-side API
 URL url = new URL("http://.../atm/balance");

 HttpURLConnection conn = (HttpURLConnection) url.openConnection();
              Old
 conn.setRequestMethod("GET");

 conn.setDoInput(true);

 conn.setDoOutput(false);

             

 BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));

 String line;

 while ((line = br.readLine()) != null) {

     out.println(line);

 }#


 Client client = ClientFactory.newClient();#
 String balance = client.target("http://.../atm/balance")#
                        .request()#
                        .get(String.class);#                                New
17   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Client API

// Get instance of Client	
Client client = ClientFactory.newClient();	
	
Can also inject @URI for the target ß	
	
// Get account balance	
String bal = client.target("http://.../atm/balance")	
    .pathParam("card", "111122223333")	
    .queryParam("pin", "9876") 	
    .request().get(String.class);	
	

18   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Client API (contd.)

// Withdraw some money	
Money mon = client.target("http://.../atm/withdraw")	
    .pathParam("card", "111122223333")	
    .queryParam("pin", "9876")	
    .request("application/json")	
    .post(text("50.0"), Money.class);	




19   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Generic Interface (Command pattern,
     Batch processing)
Invocation inv1 = 	
    client.target("http://.../atm/balance")…	
    .request().buildGet();	
	
Invocation inv2 = 	
    client.target("http://.../atm/withdraw")…	
    .request()	
    .buildPost(text("50.0"));	
	



20   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Generic Interface (contd.)
	
Collection<Invocation> invs = 	
  Arrays.asList(inv1, inv2);	
	
Collection<Response> ress = 	
  Collections.transform(invs, 	
    new F<Invocation, Response>() {	
      public Response apply(Invocation inv) {	
         return inv.invoke(); 	
      }	
    });	


21   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
New in JAX-RS 2.0

     •  Client API
     •  Filters and Interceptors
     •  Client-side and Server-side Asynchronous
     •  Improved Connection Negotiation
     •  Validation
     •  Hypermedia
     •  Alignment with JSR 330


22   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Filters & Interceptors – Motivation

     •  Customize JAX-RS implementations via well-defined
        extension points
     •  Use Cases: Logging, Compression, Security, Etc.
     •  Shared by client and server APIs
     •  Supported by most JAX-RS 1.0 implementations
           •  All using slightly different types or semantics




23   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Filters

     •  Non-wrapping extension points
        •  Pre: Interface RequestFilter	
        •  Post: Interface ResponseFilter	

     •  Part of a filter chain
     •  Do not call the next filter directly
     •  Each filter decides to proceed or break chain
        •  By returning FilterAction.NEXT or FilterAction.STOP	



24   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Filter Example: LoggingFilter
@Provider	
class LoggingFilter 	
    implements RequestFilter, ResponseFilter {	
	
    @Override	
    public FilterAction preFilter(FilterContext ctx) 	
       throws IOException {	
         logRequest(ctx.getRequest());	
         return FilterAction.NEXT;	
    }	
	
    …	
	
    25   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Filter Example: LoggingFilter (contd.)

	
          @Override	
           public FilterAction postFilter(FilterContext ctx) 	
             throws IOException {	
               logResponse(ctx.getResponse());	
               return FilterAction.NEXT;	
           } 	
	
    }	



     26   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Interceptors

     •  Wrapping extension points
        •  ReadFrom: Interface ReaderInterceptor	
        •  WriteTo: Interface WriterInterceptor	

     •  Part of an interceptor chain
     •  Call the next handler directly
     •  Each handler decides to proceed or break chain
        •  By calling ctx.proceed()	



27   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Handler Example: GzipInterceptor!
@Provider	
class GzipInterceptor implements ReaderInterceptor,
WriterInterceptor {	
	
     @Override	
     public Object aroundReadFrom(ReadInterceptorContext ctx) 	
         throws IOException {	
         if (gzipEncoded(ctx)) {	
             InputStream old = ctx.getInputStream();	
             ctx.setInputStream(new GZIPInputStream(old));	
         }	
         return ctx.proceed();	
     } 	
… }	
	 28   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Order of Execution

          Request                                             WriteTo       Request            ReadFrom
           Filter                                             Handler        Filter             Handler




       ReadFrom                                            Response         WriteTo            Response
        Handler                                              Filter         Handler              Filter

                                        Client                                        Server




29   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Binding Example: LoggingFilter!
     @NameBinding 	 	// or @Qualifier ?	
     @Target({ElementType.TYPE, ElementType.METHOD})	
     @Retention(value = RetentionPolicy.RUNTIME)	
     public @interface Logged {	
     }	
     	
     @Provider	
     @Logged	
     public class LoggingFilter implements RequestFilter, 	
         ResponseFilter 	
     { … }	
     	



30   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Binding Example: LoggingFilter!
     @Path("/")	
     public class MyResourceClass {	
     	
         @Logged	
         @GET	
         @Produces("text/plain")	
         @Path("{name}")	
         public String hello(@PathParam("name") String name) {	
             return "Hello " + name;	
         }	
     }	
     	


31   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
New in JAX-RS 2.0

     •  Client API
     •  Filters and Interceptors
     •  Client-side and Server-side Asynchronous
     •  Improved Connection Negotiation
     •  Validation
     •  Hypermedia
     •  Alignment with JSR 330


32   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Asynchronous – Motivation

     •  Let “borrowed” threads run free!
        •  Container environment

     •  Suspend and resume connections
        •  Suspend while waiting for an event
        •  Resume when event arrives

     •  Leverage Servlet 3.X async support (if available)
     •  Client API support
        •  Future<RESPONSE>, InvocationCallback<RESPONSE>


33   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Suspend and Resume
 @Path("/async/longRunning")	
 public class MyResource {    	
   @Context private ExecutionContext ctx;	
 	
   @GET @Produces("text/plain")	
   public void longRunningOp() {	
     Executors.newSingleThreadExecutor().submit(	
       new Runnable() {	
           public void run() { 	
               Thread.sleep(10000);     // Sleep 10 secs	
               ctx.resume("Hello async world!"); 	
           } });	
     ctx.suspend(); 	 	// Suspend connection and return	
   } … }   	
34   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: @Suspend Annotation
     @Path("/async/longRunning")	
     public class MyResource {    	
       @Context private ExecutionContext ctx;	
     	
       @GET @Produces("text/plain") @Suspend	
       public void longRunning() {	
         Executors.newSingleThreadExecutor().submit(	
           new Runnable() {	
               public void run() { 	
                   Thread.sleep(10000);     // Sleep 10 secs	
                   ctx.resume("Hello async world!"); 	
               } });	
         // ctx.suspend(); Suspend connection and return	
       } … }   	
35   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Client API Async Support
 // Build target URI	
 Target target = client.target("http://.../atm/balance")…	
     	
 // Start async call and register callback	
 Future<?> handle = target.request().async().get(	
     new InvocationCallback<String>() {	
         public void complete(String balance) { … }	
         public void failed(InvocationException e) { … }	
       });	
   	
 // After waiting for a while …	
 If (!handle.isDone()) handle.cancel(true);	
 	

36   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
New in JAX-RS 2.0

     •  Client API
     •  Filters and Interceptors
     •  Client-side and Server-side Asynchronous
     •  Improved Connection Negotiation
     •  Validation
     •  Hypermedia
     •  Alignment with JSR 330


37   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Improved Connection Negotiation

        GET http://.../widgets2	
        Accept: text/*; q=1	
        …	
        	
        Path("widgets2")	
        public class WidgetsResource2 {	
           @GET	
           @Produces("text/plain", 	
                     "text/html")	
           public Widgets getWidget() {...}	
        }	

38   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Improved Conneg (contd.)

        GET http://.../widgets2	
        Accept: text/*; q=1	
        …	
        	
        Path("widgets2")	
        public class WidgetsResource2 {	
           @GET	
           @Produces("text/plain;qs=0.5",	
                     "text/html;qs=0.75")	
           public Widgets getWidget() {...}	
        }	

39   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
New in JAX-RS 2.0

     •  Client API
     •  Filters and Interceptors
     •  Client-side and Server-side Asynchronous
     •  Improved Connection Negotiation
     •  Validation
     •  Hypermedia
     •  Alignment with JSR 330


40   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Validation – Motivation

     •  Services must validate data
     •  Bean Validation already provides the mechanism
        •  Integration into JAX-RS

     •  Support for constraint annotations in:
        •  Fields and properties
        •  Parameters (including request entity)
        •  Methods (response entities)
        •  Resource classes


41   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Constraint Annotations
   @Path("/")	
   class MyResourceClass {	
   	
         @POST	
         @Consumes(MediaType.APPLICATION_FORM_URLENCODED)	
Built-in public void registerUser(	
               @NotNull @FormParam("firstName") String fn,	
Custom
               @NotNull @FormParam("lastName") String ln,	
               @Email @FormParam("email") String em) {	
               ... } 	
   }	
      	


 42   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: User defined Constraints
     @Target({ METHOD, FIELD, PARAMETER })	
     @Retention(RUNTIME)	
     @Constraint(validatedBy = EmailValidator.class)	
     public @interface Email { ... }	
     	
     class EmailValidator 	
       implements ConstraintValidator<Email, String> {	
         public void initialize(Email email) {	
             … }	
         public boolean isValid(String value,     	
             ConstraintValidatorContext context) {	
             // Check 'value' is e-mail address 	
             … } }	

43   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Request Entity Validation
@CheckUser1	
class User { ... }	
	
@Path("/")	
class MyResourceClass {	
    @POST	
    @Consumes("application/xml")	
    public void registerUser1(@Valid User u) { … } 	
	
    @POST	
    @Consumes("application/json")	
    public void registerUser12(@CheckUser2 @Valid User u)
{ … } 	
}	
 44   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
New in JAX-RS 2.0

     •  Client API
     •  Filters and Interceptors
     •  Client-side and Server-side Asynchronous
     •  Improved Connection Negotiation
     •  Validation
     •  Hypermedia
     •  Alignment with JSR 330


45   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Motivation

     •  REST principles
        •  Identifiers and Links
        •  HATEOAS (Hypermedia As The Engine Of App State)

     •  Link types:
        •  Structural Links
        •  Transitional Links




46   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Structural vs. Transitional Links
     Link: <http://.../orders/1/ship>; rel=ship,	
            <http://.../orders/1/cancel>; rel=cancel	   Transitional
     ...	
     <order id="1">	
       <customer>http://.../customers/11</customer>	
       <address>http://.../customers/11/address/1</customer>	
       <items>	
          <item>	                                         Structural

            <product>http://.../products/111</products>	
            <quantity>2</quantity>	
       </item>	
       ... </order>    	


47   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Using Transitional Links
// Server API	
Response res = Response.ok(order)	
      .link("http://.../orders/1/ship", "ship")	
      .build();	
      	
// Client API	
Response order = client.target(…)	
      .request("application/xml").get();	
	
if (order.getLink(“ship”) != null) {          	
      Response shippedOrder = client	
          .target(order.getLink("ship"))	
          .request("application/xml").post(null);	
    … }	
  	
 48   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Other Topics Under Consideration

     •  Better integration with JSR 330
        •  Support @Inject and qualifiers

     •  High-level client API?




49   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
More Information

     •  JSR: http://jcp.org/en/jsr/detail?id=339
     •  Java.net: http://jax-rs-spec.java.net
     •  User Alias: users@jax-rs-spec.java.net
        •  All EG discussions forwarded to this list




50   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Q&A


51   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

More Related Content

What's hot

Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsStormpath
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongMario Fusco
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewShahed Chowdhuri
 
Testing RESTful web services with REST Assured
Testing RESTful web services with REST AssuredTesting RESTful web services with REST Assured
Testing RESTful web services with REST AssuredBas Dijkstra
 
Spring boot Under Da Hood
Spring boot Under Da HoodSpring boot Under Da Hood
Spring boot Under Da HoodMichel Schudel
 
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A GrzesikApache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesikmfrancis
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
Spring integration을 통해_살펴본_메시징_세계
Spring integration을 통해_살펴본_메시징_세계Spring integration을 통해_살펴본_메시징_세계
Spring integration을 통해_살펴본_메시징_세계Wangeun Lee
 
From Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfFrom Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfJosé Paumard
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersFinally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersRudy De Busscher
 
Angular Interview Questions & Answers
Angular Interview Questions & AnswersAngular Interview Questions & Answers
Angular Interview Questions & AnswersRatnala Charan kumar
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by defaultSecuRing
 

What's hot (20)

An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Hibernate tutorial
Hibernate tutorialHibernate tutorial
Hibernate tutorial
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are Wrong
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
 
Testing RESTful web services with REST Assured
Testing RESTful web services with REST AssuredTesting RESTful web services with REST Assured
Testing RESTful web services with REST Assured
 
API for Beginners
API for BeginnersAPI for Beginners
API for Beginners
 
Spring boot Under Da Hood
Spring boot Under Da HoodSpring boot Under Da Hood
Spring boot Under Da Hood
 
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A GrzesikApache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
Apache Karaf - Building OSGi applications on Apache Karaf - T Frank & A Grzesik
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
Spring integration을 통해_살펴본_메시징_세계
Spring integration을 통해_살펴본_메시징_세계Spring integration을 통해_살펴본_메시징_세계
Spring integration을 통해_살펴본_메시징_세계
 
Rest API
Rest APIRest API
Rest API
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Introduction to kotlin
Introduction to kotlinIntroduction to kotlin
Introduction to kotlin
 
From Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfFrom Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdf
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersFinally, easy integration testing with Testcontainers
Finally, easy integration testing with Testcontainers
 
Maven tutorial
Maven tutorialMaven tutorial
Maven tutorial
 
Angular Interview Questions & Answers
Angular Interview Questions & AnswersAngular Interview Questions & Answers
Angular Interview Questions & Answers
 
RESTful API Design, Second Edition
RESTful API Design, Second EditionRESTful API Design, Second Edition
RESTful API Design, Second Edition
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
 

Viewers also liked

Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Dmytro Chyzhykov
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
RestFull Webservices with JAX-RS
RestFull Webservices with JAX-RSRestFull Webservices with JAX-RS
RestFull Webservices with JAX-RSNeil Ghosh
 
Easy REST APIs with Jersey and RestyGWT
Easy REST APIs with Jersey and RestyGWTEasy REST APIs with Jersey and RestyGWT
Easy REST APIs with Jersey and RestyGWTDavid Chandler
 
Java Web Services [5/5]: REST and JAX-RS
Java Web Services [5/5]: REST and JAX-RSJava Web Services [5/5]: REST and JAX-RS
Java Web Services [5/5]: REST and JAX-RSIMC Institute
 
REST Level 5 - A Trek To The Summit
REST Level 5 - A Trek To The SummitREST Level 5 - A Trek To The Summit
REST Level 5 - A Trek To The SummitPat Cappelaere
 
Web services restful con JAX-RS
Web services restful con JAX-RSWeb services restful con JAX-RS
Web services restful con JAX-RSVortexbird
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web servicesnbuddharaju
 
Using Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSUsing Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSKatrien Verbert
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RSArun Gupta
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSCarol McDonald
 
Introduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web ServicesIntroduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web Servicesecosio GmbH
 
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
 
Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WSIndicThreads
 

Viewers also liked (20)

Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0Making Java REST with JAX-RS 2.0
Making Java REST with JAX-RS 2.0
 
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
 
RestFull Webservices with JAX-RS
RestFull Webservices with JAX-RSRestFull Webservices with JAX-RS
RestFull Webservices with JAX-RS
 
Easy REST APIs with Jersey and RestyGWT
Easy REST APIs with Jersey and RestyGWTEasy REST APIs with Jersey and RestyGWT
Easy REST APIs with Jersey and RestyGWT
 
Java Web Services [5/5]: REST and JAX-RS
Java Web Services [5/5]: REST and JAX-RSJava Web Services [5/5]: REST and JAX-RS
Java Web Services [5/5]: REST and JAX-RS
 
REST Level 5 - A Trek To The Summit
REST Level 5 - A Trek To The SummitREST Level 5 - A Trek To The Summit
REST Level 5 - A Trek To The Summit
 
Web services restful con JAX-RS
Web services restful con JAX-RSWeb services restful con JAX-RS
Web services restful con JAX-RS
 
Overview of web services
Overview of web servicesOverview of web services
Overview of web services
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
Using Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSUsing Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RS
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RS
 
Web services
Web servicesWeb services
Web services
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RS
 
Introduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web ServicesIntroduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web Services
 
Introduction to RESTful Webservices in JAVA
Introduction to RESTful Webservices  in JAVA Introduction to RESTful Webservices  in JAVA
Introduction to RESTful Webservices in JAVA
 
Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WS
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 
SOAP-based Web Services
SOAP-based Web ServicesSOAP-based Web Services
SOAP-based Web Services
 

Similar to JAX-RS 2.0: RESTful Web Services

JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX LondonJAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX LondonArun Gupta
 
JAX RS 2.0 - OTN Bangalore 2013
JAX RS 2.0 - OTN Bangalore 2013JAX RS 2.0 - OTN Bangalore 2013
JAX RS 2.0 - OTN Bangalore 2013Jagadish Prasath
 
Project Helidon Overview (Japanese)
Project Helidon Overview (Japanese)Project Helidon Overview (Japanese)
Project Helidon Overview (Japanese)Logico
 
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun GuptaJAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun GuptaJAX London
 
112815 java ee8_davidd
112815 java ee8_davidd112815 java ee8_davidd
112815 java ee8_daviddTakashi Ito
 
Java EE7
Java EE7Java EE7
Java EE7Jay Lee
 
ADBA (Asynchronous Database Access)
ADBA (Asynchronous Database Access)ADBA (Asynchronous Database Access)
ADBA (Asynchronous Database Access)Logico
 
Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014Jagadish Prasath
 
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute InfodeckServlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute InfodeckEdward Burns
 
OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7Bruno Borges
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Arun Gupta
 
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...jaxLondonConference
 
Oracle GoldenGate 18c - REST API Examples
Oracle GoldenGate 18c - REST API ExamplesOracle GoldenGate 18c - REST API Examples
Oracle GoldenGate 18c - REST API ExamplesBobby Curtis
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Max Andersen
 
Getting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in JavaGetting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in JavaArun Gupta
 
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGThe Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGArun Gupta
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Reza Rahman
 

Similar to JAX-RS 2.0: RESTful Web Services (20)

JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX LondonJAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
 
JAX RS 2.0 - OTN Bangalore 2013
JAX RS 2.0 - OTN Bangalore 2013JAX RS 2.0 - OTN Bangalore 2013
JAX RS 2.0 - OTN Bangalore 2013
 
Project Helidon Overview (Japanese)
Project Helidon Overview (Japanese)Project Helidon Overview (Japanese)
Project Helidon Overview (Japanese)
 
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun GuptaJAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
JAX-RS 2.0: New and Noteworthy in RESTful Web Services API - Arun Gupta
 
112815 java ee8_davidd
112815 java ee8_davidd112815 java ee8_davidd
112815 java ee8_davidd
 
Java EE7
Java EE7Java EE7
Java EE7
 
Java ee7 1hour
Java ee7 1hourJava ee7 1hour
Java ee7 1hour
 
ADBA (Asynchronous Database Access)
ADBA (Asynchronous Database Access)ADBA (Asynchronous Database Access)
ADBA (Asynchronous Database Access)
 
Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014Java EE 7 in practise - OTN Hyderabad 2014
Java EE 7 in practise - OTN Hyderabad 2014
 
JAX-RS.next
JAX-RS.nextJAX-RS.next
JAX-RS.next
 
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute InfodeckServlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
 
OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5
 
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
 
Oracle GoldenGate 18c - REST API Examples
Oracle GoldenGate 18c - REST API ExamplesOracle GoldenGate 18c - REST API Examples
Oracle GoldenGate 18c - REST API Examples
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
 
Getting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in JavaGetting Started with WebSocket and Server-Sent Events in Java
Getting Started with WebSocket and Server-Sent Events in Java
 
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGThe Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
 
Java SE 8
Java SE 8Java SE 8
Java SE 8
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?
 

More from 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
 

More from 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
 

Recently uploaded

Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 

Recently uploaded (20)

Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 

JAX-RS 2.0: RESTful Web Services

  • 1. JAX-RS 2.0: RESTful Java on Steroids Arun Gupta, Java EE & GlassFish Guy http://blogs.oracle.com/arungupta, @arungupta 1 Copyright © 2012, 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 © 2012, Oracle and/or its affiliates. All rights reserved. 2011,
  • 3. Part I: How we got here ? 3 Copyright © 2012, 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.0 4 Copyright © 2012, 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 communications 5 Copyright © 2012, 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 EE 6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 7. Example: JAX-RS API Resources @Path("/atm/{cardId}") URI Parameter public 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 © 2012, 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 © 2012, Oracle and/or its affiliates. All rights reserved.
  • 9. Example: JAX-RS API (contd.) 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 10. Example: JAX-RS API (contd.) 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 11. Requested Features •  Client API •  Client-side and Server-side Asynchronous •  Filters and Interceptors •  Improved Connection Negotiation •  Validation •  Hypermedia •  Alignment with JSR 330 •  Model-View-Controller 11 Copyright © 2012, 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 3 published on Jun 7, 2012! 12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 13. Part II: Where We Are Going 13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 14. In-Scope Features •  Client API •  Filters and Interceptors •  Client-side and Server-side Asynchronous •  Improved Connection Negotiation •  Validation •  Hypermedia •  Alignment with JSR 330 •  Model-View-Controller 14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 15. New in JAX-RS 2.0 •  Client API •  Filters and Interceptors •  Client-side and Server-side Asynchronous •  Improved Connection Negotiation •  Validation •  Hypermedia •  Alignment with JSR 330 15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 16. Client API - 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 standard 16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 17. Client API – Old and New •  Client-side API URL url = new URL("http://.../atm/balance");
 HttpURLConnection conn = (HttpURLConnection) url.openConnection();
 Old conn.setRequestMethod("GET");
 conn.setDoInput(true);
 conn.setDoOutput(false);
             
 BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
 String line;
 while ((line = br.readLine()) != null) {
     out.println(line);
 }# Client client = ClientFactory.newClient();# String balance = client.target("http://.../atm/balance")# .request()# .get(String.class);# New 17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 18. Example: Client API // Get instance of Client Client client = ClientFactory.newClient(); Can also inject @URI for the target ß // Get account balance String bal = client.target("http://.../atm/balance") .pathParam("card", "111122223333") .queryParam("pin", "9876") .request().get(String.class); 18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 19. Example: Client API (contd.) // Withdraw some money Money mon = client.target("http://.../atm/withdraw") .pathParam("card", "111122223333") .queryParam("pin", "9876") .request("application/json") .post(text("50.0"), Money.class); 19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 20. Example: Generic Interface (Command pattern, Batch processing) Invocation inv1 = client.target("http://.../atm/balance")… .request().buildGet(); Invocation inv2 = client.target("http://.../atm/withdraw")… .request() .buildPost(text("50.0")); 20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 21. Example: Generic Interface (contd.) Collection<Invocation> invs = Arrays.asList(inv1, inv2); Collection<Response> ress = Collections.transform(invs, new F<Invocation, Response>() { public Response apply(Invocation inv) { return inv.invoke(); } }); 21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 22. New in JAX-RS 2.0 •  Client API •  Filters and Interceptors •  Client-side and Server-side Asynchronous •  Improved Connection Negotiation •  Validation •  Hypermedia •  Alignment with JSR 330 22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 23. Filters & Interceptors – Motivation •  Customize JAX-RS implementations via well-defined extension points •  Use Cases: Logging, Compression, Security, Etc. •  Shared by client and server APIs •  Supported by most JAX-RS 1.0 implementations •  All using slightly different types or semantics 23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 24. Filters •  Non-wrapping extension points •  Pre: Interface RequestFilter •  Post: Interface ResponseFilter •  Part of a filter chain •  Do not call the next filter directly •  Each filter decides to proceed or break chain •  By returning FilterAction.NEXT or FilterAction.STOP 24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 25. Filter Example: LoggingFilter @Provider class LoggingFilter implements RequestFilter, ResponseFilter { @Override public FilterAction preFilter(FilterContext ctx) throws IOException { logRequest(ctx.getRequest()); return FilterAction.NEXT; } … 25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 26. Filter Example: LoggingFilter (contd.) @Override public FilterAction postFilter(FilterContext ctx) throws IOException { logResponse(ctx.getResponse()); return FilterAction.NEXT; } } 26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 27. Interceptors •  Wrapping extension points •  ReadFrom: Interface ReaderInterceptor •  WriteTo: Interface WriterInterceptor •  Part of an interceptor chain •  Call the next handler directly •  Each handler decides to proceed or break chain •  By calling ctx.proceed() 27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 28. Handler Example: GzipInterceptor! @Provider class GzipInterceptor implements ReaderInterceptor, WriterInterceptor { @Override public Object aroundReadFrom(ReadInterceptorContext ctx) throws IOException { if (gzipEncoded(ctx)) { InputStream old = ctx.getInputStream(); ctx.setInputStream(new GZIPInputStream(old)); } return ctx.proceed(); } … } 28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 29. Order of Execution Request WriteTo Request ReadFrom Filter Handler Filter Handler ReadFrom Response WriteTo Response Handler Filter Handler Filter Client Server 29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 30. Binding Example: LoggingFilter! @NameBinding // or @Qualifier ? @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(value = RetentionPolicy.RUNTIME) public @interface Logged { } @Provider @Logged public class LoggingFilter implements RequestFilter, ResponseFilter { … } 30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 31. Binding Example: LoggingFilter! @Path("/") public class MyResourceClass { @Logged @GET @Produces("text/plain") @Path("{name}") public String hello(@PathParam("name") String name) { return "Hello " + name; } } 31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 32. New in JAX-RS 2.0 •  Client API •  Filters and Interceptors •  Client-side and Server-side Asynchronous •  Improved Connection Negotiation •  Validation •  Hypermedia •  Alignment with JSR 330 32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 33. Asynchronous – Motivation •  Let “borrowed” threads run free! •  Container environment •  Suspend and resume connections •  Suspend while waiting for an event •  Resume when event arrives •  Leverage Servlet 3.X async support (if available) •  Client API support •  Future<RESPONSE>, InvocationCallback<RESPONSE> 33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 34. Example: Suspend and Resume @Path("/async/longRunning") public class MyResource { @Context private ExecutionContext ctx; @GET @Produces("text/plain") public void longRunningOp() { Executors.newSingleThreadExecutor().submit( new Runnable() { public void run() { Thread.sleep(10000); // Sleep 10 secs ctx.resume("Hello async world!"); } }); ctx.suspend(); // Suspend connection and return } … } 34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 35. Example: @Suspend Annotation @Path("/async/longRunning") public class MyResource { @Context private ExecutionContext ctx; @GET @Produces("text/plain") @Suspend public void longRunning() { Executors.newSingleThreadExecutor().submit( new Runnable() { public void run() { Thread.sleep(10000); // Sleep 10 secs ctx.resume("Hello async world!"); } }); // ctx.suspend(); Suspend connection and return } … } 35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 36. Example: Client API Async Support // Build target URI Target target = client.target("http://.../atm/balance")… // Start async call and register callback Future<?> handle = target.request().async().get( new InvocationCallback<String>() { public void complete(String balance) { … } public void failed(InvocationException e) { … } }); // After waiting for a while … If (!handle.isDone()) handle.cancel(true); 36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 37. New in JAX-RS 2.0 •  Client API •  Filters and Interceptors •  Client-side and Server-side Asynchronous •  Improved Connection Negotiation •  Validation •  Hypermedia •  Alignment with JSR 330 37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 38. Improved Connection Negotiation GET http://.../widgets2 Accept: text/*; q=1 … Path("widgets2") public class WidgetsResource2 { @GET @Produces("text/plain", "text/html") public Widgets getWidget() {...} } 38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 39. Improved Conneg (contd.) GET http://.../widgets2 Accept: text/*; q=1 … Path("widgets2") public class WidgetsResource2 { @GET @Produces("text/plain;qs=0.5", "text/html;qs=0.75") public Widgets getWidget() {...} } 39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 40. New in JAX-RS 2.0 •  Client API •  Filters and Interceptors •  Client-side and Server-side Asynchronous •  Improved Connection Negotiation •  Validation •  Hypermedia •  Alignment with JSR 330 40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 41. Validation – Motivation •  Services must validate data •  Bean Validation already provides the mechanism •  Integration into JAX-RS •  Support for constraint annotations in: •  Fields and properties •  Parameters (including request entity) •  Methods (response entities) •  Resource classes 41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 42. Example: Constraint Annotations @Path("/") class MyResourceClass { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Built-in public void registerUser( @NotNull @FormParam("firstName") String fn, Custom @NotNull @FormParam("lastName") String ln, @Email @FormParam("email") String em) { ... } } 42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 43. Example: User defined Constraints @Target({ METHOD, FIELD, PARAMETER }) @Retention(RUNTIME) @Constraint(validatedBy = EmailValidator.class) public @interface Email { ... } class EmailValidator implements ConstraintValidator<Email, String> { public void initialize(Email email) { … } public boolean isValid(String value, ConstraintValidatorContext context) { // Check 'value' is e-mail address … } } 43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 44. Example: Request Entity Validation @CheckUser1 class User { ... } @Path("/") class MyResourceClass { @POST @Consumes("application/xml") public void registerUser1(@Valid User u) { … } @POST @Consumes("application/json") public void registerUser12(@CheckUser2 @Valid User u) { … } } 44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 45. New in JAX-RS 2.0 •  Client API •  Filters and Interceptors •  Client-side and Server-side Asynchronous •  Improved Connection Negotiation •  Validation •  Hypermedia •  Alignment with JSR 330 45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 46. Motivation •  REST principles •  Identifiers and Links •  HATEOAS (Hypermedia As The Engine Of App State) •  Link types: •  Structural Links •  Transitional Links 46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 47. Example: Structural vs. Transitional Links Link: <http://.../orders/1/ship>; rel=ship, <http://.../orders/1/cancel>; rel=cancel Transitional ... <order id="1"> <customer>http://.../customers/11</customer> <address>http://.../customers/11/address/1</customer> <items> <item> Structural <product>http://.../products/111</products> <quantity>2</quantity> </item> ... </order> 47 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 48. Example: Using Transitional Links // Server API Response res = Response.ok(order) .link("http://.../orders/1/ship", "ship") .build(); // Client API Response order = client.target(…) .request("application/xml").get(); if (order.getLink(“ship”) != null) { Response shippedOrder = client .target(order.getLink("ship")) .request("application/xml").post(null); … } 48 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 49. Other Topics Under Consideration •  Better integration with JSR 330 •  Support @Inject and qualifiers •  High-level client API? 49 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 50. More Information •  JSR: http://jcp.org/en/jsr/detail?id=339 •  Java.net: http://jax-rs-spec.java.net •  User Alias: users@jax-rs-spec.java.net •  All EG discussions forwarded to this list 50 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 51. Q&A 51 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.