SlideShare une entreprise Scribd logo
1  sur  181
The Newest
 JAX-RS Features




      Jan Algermissen

 NORD Software Consulting
@algermissen • http://jalg.net
What’s in 2.0 For Me?
What’s in 2.0 For Me?
          Client
 API
What’s in 2.0 For Me?
          Client
 API
          Filters
What’s in 2.0 For Me?
          Client
 API
          Filters
          Interceptors
What’s in 2.0 For Me?
          Client
 API
          Filters
          Interceptors
          Async
What’s in 2.0 For Me?
          Client
 API
          Filters
          Interceptors
          Async
          Hypermedia
What’s in 2.0 For Me?
          Client
 API
          Filters
          Interceptors
          Async
          Hypermedia
          ResourceContext
Client API
  Now
 I
 am
 standardized!
Client client = ClientFactory.newClient();

client.register(CustomerMessageBodyWriter.class);
client.register(CustomerMessageBodyReader.class);

client.register(SomeFeature.class);

client.setProperty(CLIENT_CACHE_SIZE,100);
Aiming at WebTargets
     WebTarget crmWt = client
     
 
 .target(http://example.com/crm);

     WebTarget customersWT = crm.path(customers);

     WebTarget frenchCustWT = customersWt
             .matrixParam(country,france);

     WebTarget custSearchWT = frenchCustWT
                  .queryParam(q,Yves);
WebTarget carWT = client
.target(http://example.com/car/{plateNr});

carWT.resolveTemplate(plateNr,HH-TZ-101);
carWT.resolveTemplate(plateNr,M-KL-1982);
carWT.resolveTemplate(plateNr,F-EK-7622);
carWT.resolveTemplate(plateNr,HB-RE-223);
carWT.resolveTemplate(plateNr,B-AM-8719);
Launching Requests

Response res =
 customerWt
 .request(application/customer)
 .get();

int status = res.getStatus();
Locale loc = res.getLanguage();
Link editLink = res.getLink(edit);
Customer c = res.readEntity(
              Customer.class);
Sending Data

WebTarget customersWT = client

 
 .target(http://crm.example.com/customers);

Customer customer = new Customer(Pebbles Flintstone);

Response res = customersWT.request(application/customer).post(

 
 Entity.entity(customer, application/customer));
import static javax.ws.rs.client.Entity.*;

...post( Entity.entity(customer, application/customer) );

...post(xml(customer));
...post(json(customer));
...post(text(customer));
...post(html(customer));

...post( form(
   new Form(firstname,Pebbles).param(surname , Flintstone)
 ));


                      Request entity
                      encoding optio
                                    ns
Why build many...



WebTarget latestCustomersWT = client

 
 .target(http://example.com/customers/latest);

while( keepPolling ) {
  Response res = latestCustomersWT.request(application/atom+xml)
            .acceptLanguage(de)
            .header(...).header(...).get();
  ...
}
...if you can use just one?
WebTarget latestCustomersWT = client
 .target(http://example.com/customers/latest);

Invocation poll = latestCustomersWT
   .request(application/atom+xml)
   .acceptLanguage(de)
   .header(...).header(...).buildGet();

while( keepPolling ) {
  Response res = poll.invoke();
  ...
}
Need variations on a theme?
InvocationBuilder pollBuilder = latestCustomersWT
   .request(application/atom+xml).acceptLanguage(de)
   .header(...).header(...);

while( keepPolling ) {
  Response res = pollBuilder.header(If-None-Match,etag).get();
  if( notModified )
    continue;
  ...
}
Creating a Bunch of Customers
InvocationBuilder createBuilder = customersWT
                         .request(application/customer)
                         .acceptLanguage(de)
                           .header(...).header(...);

for(Customer c : newCustomers ) {
  Response res = createBuilder.post(

 
             Entity.entity(c, application/customer));
}



                    InvocationBuilder
 works
 
                     for
 sending
 data,
 too.
@Uri(http://crm/news)

           @Uri
 creates
 WebTargets.

       @Uri(http://example.com/crm)
       WebTarget crmServiceWt;

       @Uri(entries/latest);
       WebTarget latestEntriesWt;
@Uri(orders/{name})
                                                Inside
 a
 
     resource
 class
 you
 may
 use
 
             templates.
            @Path(users/{name})
            pulic class UserResource {

                  @Uri(orders/{name})
                  WebTarget userOrderWt;

                  @Uri(http://mail.org/box/{name});
                  WebTarget userMailboxWt;
            }
Client API
Client API
-
 4
 core
 classes
Client API
-
 4
 core
 classes
-
 providers
 must
 be
 .registered()
Client API
-
 4
 core
 classes
-
 providers
 must
 be
 .registered()
-
 Fluent
 API,
 immutable
 instances
Client API
-
 4
 core
 classes
-
 providers
 must
 be
 .registered()
-
 Fluent
 API,
 immutable
 instances
-
 .request(
 [accept]
 )
Client API
-
 4
 core
 classes
-
 providers
 must
 be
 .registered()
-
 Fluent
 API,
 immutable
 instances
-
 .request(
 [accept]
 )
-
 request
 body
 -
 Entity
 class
Client API
-
 4
 core
 classes
-
 providers
 must
 be
 .registered()
-
 Fluent
 API,
 immutable
 instances
-
 .request(
 [accept]
 )
-
 request
 body
 -
 Entity
 class
-
 separation
 of
 concerns
 (Invocation)
Client API
-
 4
 core
 classes
-
 providers
 must
 be
 .registered()
-
 Fluent
 API,
 immutable
 instances
-
 .request(
 [accept]
 )
-
 request
 body
 -
 Entity
 class
-
 separation
 of
 concerns
 (Invocation)
-@Uri
@Provider
                                Filters
public class MyFilter implements
                  ContainerRequestFilter,
                  ContainerResponseFilter {


   public void filter(ContainerRequestContext req) {
    // mutable request

   }


   public void filter(ContainerRequestContext req,
            ContainerResponseContext res) {

   
 // mutable response, immutable request

   }
}
er
  rv e
Se i d
   -s
er
  rv e
Se i d
   -s
er
  rv e
Se i d
   -s
er
  rv e
Se i d
   -s
er
  rv e
Se i d
   -s
er
  rv e
Se i d
   -s
er
  rv e
Se i d
   -s
er
  rv e
Se i d
   -s
-
    nt
 lie e
C d si
-
    nt
 lie e
C d si
-
    nt
 lie e
C d si
-
    nt
 lie e
C d si
-
    nt
 lie e
C d si
-
    nt
 lie e
C d si
-
    nt
 lie e
C d si
Logging Filter
public void filter(ClientRequestContext req) ... {

    log.info( +req.getMethod()+ +req.getUri().toASCIIString());

  MultivaluedMapString, String headers = req.getStringHeaders();
  for (String key : headers.keySet()) {

    ListString values = headers.get(key);
   log.info( +key+: +headers.get(key));

 }

}
Header-Decorating Filter
@Provider
public class CacheControlDecoratorFilter implements
                        ContainerResponseFilter {


 public void filter(ContainerRequestContext req,

 
 
 ContainerResponseContext res) throws IOException {

 
  res.getHeaders().putSingle(
    Cache-Control,max-age=60,must-revalidate);

 }
}
@Provider @PreMatching
public class RewriteFilter implements
                   ContainerRequestFilter {


 public void filter(ContainerRequestContext req)...{

 
 UriInfo uriInfo = req.getUriInfo();

 
 URI rewrittenUri = uriInfo.getRequestUri();
  ....

 
 req.setRequestUri(rewrittenUri);

 }
}
Abort Filter Chain
if( !isValid(authToken) )
   req.abortWith(Response.status(401).build());
Authentication Filter
@Override
public void filter(ContainerRequestContext req)
                        throws IOException {
 URI loginUri = UriBuilder
      .fromMethod(LoginResource.class, getLoginForm)
      .build();

 String authToken = req.getCookies().get(sid).getValue();


 if( !isValid(authToken) ) {

   req.abortWith(Response.temporaryRedirect(loginUri).build());

 }
}
And what about the entity?
public interface ContainerResponseContext {

    OutputStream getEntityStream();
    Object getEntity();

    void setEntityStream(OutputStream outputStream);
    void setEntity();

}


             Here
 you
 see
 how
 to
 access
 
                the

Contenu connexe

Tendances

Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling RewriterJustin Edelson
 
Dependency Injection, Zend Framework and Symfony Container
Dependency Injection, Zend Framework and Symfony ContainerDependency Injection, Zend Framework and Symfony Container
Dependency Injection, Zend Framework and Symfony ContainerDiego Lewin
 
Restful Web Service
Restful Web ServiceRestful Web Service
Restful Web ServiceBin Cai
 
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015Chef
 
25+ Reasons to use OmniFaces in JSF applications
25+ Reasons to use OmniFaces in JSF applications25+ Reasons to use OmniFaces in JSF applications
25+ Reasons to use OmniFaces in JSF applicationsAnghel Leonard
 
Sling models by Justin Edelson
Sling models by Justin Edelson Sling models by Justin Edelson
Sling models by Justin Edelson AEM HUB
 
What You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSFWhat You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSFMax Katz
 
SDPHP Lightning Talk - Let's Talk Laravel
SDPHP Lightning Talk - Let's Talk LaravelSDPHP Lightning Talk - Let's Talk Laravel
SDPHP Lightning Talk - Let's Talk Laravelmarcusamoore
 
Using the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service ClientsUsing the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service ClientsSalesforce Developers
 
Demystifying Oak Search
Demystifying Oak SearchDemystifying Oak Search
Demystifying Oak SearchJustin Edelson
 
Securing JSF Applications Against the OWASP Top Ten
Securing JSF Applications Against the OWASP Top TenSecuring JSF Applications Against the OWASP Top Ten
Securing JSF Applications Against the OWASP Top TenDavid Chandler
 
Modularizing RESTful Web Service Management with Aspect Oriented Programming
Modularizing RESTful Web Service Management with Aspect Oriented ProgrammingModularizing RESTful Web Service Management with Aspect Oriented Programming
Modularizing RESTful Web Service Management with Aspect Oriented ProgrammingWidhian Bramantya
 
Api's and ember js
Api's and ember jsApi's and ember js
Api's and ember jsEdwin Cruz
 
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
 
Field injection, type safe configuration, and more new goodies in Declarative...
Field injection, type safe configuration, and more new goodies in Declarative...Field injection, type safe configuration, and more new goodies in Declarative...
Field injection, type safe configuration, and more new goodies in Declarative...bjhargrave
 
Jasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casJasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casellentuck
 
RichFaces 4: Rich Ajax Components For Your JSF Applications
RichFaces 4: Rich Ajax Components For Your JSF ApplicationsRichFaces 4: Rich Ajax Components For Your JSF Applications
RichFaces 4: Rich Ajax Components For Your JSF ApplicationsMax Katz
 
Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013
Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013
Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013Amazon Web Services
 
Integration patterns in AEM 6
Integration patterns in AEM 6Integration patterns in AEM 6
Integration patterns in AEM 6Yuval Ararat
 

Tendances (20)

Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling Rewriter
 
Spring aop
Spring aopSpring aop
Spring aop
 
Dependency Injection, Zend Framework and Symfony Container
Dependency Injection, Zend Framework and Symfony ContainerDependency Injection, Zend Framework and Symfony Container
Dependency Injection, Zend Framework and Symfony Container
 
Restful Web Service
Restful Web ServiceRestful Web Service
Restful Web Service
 
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
 
25+ Reasons to use OmniFaces in JSF applications
25+ Reasons to use OmniFaces in JSF applications25+ Reasons to use OmniFaces in JSF applications
25+ Reasons to use OmniFaces in JSF applications
 
Sling models by Justin Edelson
Sling models by Justin Edelson Sling models by Justin Edelson
Sling models by Justin Edelson
 
What You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSFWhat You Need To Build Cool Enterprise Applications With JSF
What You Need To Build Cool Enterprise Applications With JSF
 
SDPHP Lightning Talk - Let's Talk Laravel
SDPHP Lightning Talk - Let's Talk LaravelSDPHP Lightning Talk - Let's Talk Laravel
SDPHP Lightning Talk - Let's Talk Laravel
 
Using the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service ClientsUsing the Tooling API to Generate Apex SOAP Web Service Clients
Using the Tooling API to Generate Apex SOAP Web Service Clients
 
Demystifying Oak Search
Demystifying Oak SearchDemystifying Oak Search
Demystifying Oak Search
 
Securing JSF Applications Against the OWASP Top Ten
Securing JSF Applications Against the OWASP Top TenSecuring JSF Applications Against the OWASP Top Ten
Securing JSF Applications Against the OWASP Top Ten
 
Modularizing RESTful Web Service Management with Aspect Oriented Programming
Modularizing RESTful Web Service Management with Aspect Oriented ProgrammingModularizing RESTful Web Service Management with Aspect Oriented Programming
Modularizing RESTful Web Service Management with Aspect Oriented Programming
 
Api's and ember js
Api's and ember jsApi's and ember js
Api's and ember js
 
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
 
Field injection, type safe configuration, and more new goodies in Declarative...
Field injection, type safe configuration, and more new goodies in Declarative...Field injection, type safe configuration, and more new goodies in Declarative...
Field injection, type safe configuration, and more new goodies in Declarative...
 
Jasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casJasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-cas
 
RichFaces 4: Rich Ajax Components For Your JSF Applications
RichFaces 4: Rich Ajax Components For Your JSF ApplicationsRichFaces 4: Rich Ajax Components For Your JSF Applications
RichFaces 4: Rich Ajax Components For Your JSF Applications
 
Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013
Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013
Becoming a Command Line Expert with the AWS CLI (TLS304) | AWS re:Invent 2013
 
Integration patterns in AEM 6
Integration patterns in AEM 6Integration patterns in AEM 6
Integration patterns in AEM 6
 

Similaire à JAX-RS 2.0 New Features

Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with SpringJoshua Long
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVCIndicThreads
 
ADO.NET Data Services
ADO.NET Data ServicesADO.NET Data Services
ADO.NET Data Servicesukdpe
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to TornadoGavin Roy
 
SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)Kashif Imran
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009hugowetterberg
 
Simpler by Design: Build a Better GraphQL API for Your Next App by Writing Le...
Simpler by Design: Build a Better GraphQL API for Your Next App by Writing Le...Simpler by Design: Build a Better GraphQL API for Your Next App by Writing Le...
Simpler by Design: Build a Better GraphQL API for Your Next App by Writing Le...Amazon Web Services
 
How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case Kai Sasaki
 
Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack APIKrunal Jain
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testingrdekleijn
 
Need for Speed: Removing speed bumps in API Projects
Need for Speed: Removing speed bumps in API ProjectsNeed for Speed: Removing speed bumps in API Projects
Need for Speed: Removing speed bumps in API ProjectsŁukasz Chruściel
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSam Brannen
 
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018Amazon Web Services
 
WSO2Con EU 2015: Extending and Customizing WSO2 API Manager
WSO2Con EU 2015: Extending and Customizing WSO2 API ManagerWSO2Con EU 2015: Extending and Customizing WSO2 API Manager
WSO2Con EU 2015: Extending and Customizing WSO2 API ManagerWSO2
 
Cloud native programming model comparison
Cloud native programming model comparisonCloud native programming model comparison
Cloud native programming model comparisonEmily Jiang
 
Serverless archtiectures
Serverless archtiecturesServerless archtiectures
Serverless archtiecturesIegor Fadieiev
 

Similaire à JAX-RS 2.0 New Features (20)

Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVC
 
ADO.NET Data Services
ADO.NET Data ServicesADO.NET Data Services
ADO.NET Data Services
 
RESTing with JAX-RS
RESTing with JAX-RSRESTing with JAX-RS
RESTing with JAX-RS
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)
 
Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009Services Drupalcamp Stockholm 2009
Services Drupalcamp Stockholm 2009
 
Simpler by Design: Build a Better GraphQL API for Your Next App by Writing Le...
Simpler by Design: Build a Better GraphQL API for Your Next App by Writing Le...Simpler by Design: Build a Better GraphQL API for Your Next App by Writing Le...
Simpler by Design: Build a Better GraphQL API for Your Next App by Writing Le...
 
How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case How to ensure Presto scalability 
in multi use case
How to ensure Presto scalability 
in multi use case
 
Introduction to CloudStack API
Introduction to CloudStack APIIntroduction to CloudStack API
Introduction to CloudStack API
 
Mashups
MashupsMashups
Mashups
 
Servlet
ServletServlet
Servlet
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testing
 
Need for Speed: Removing speed bumps in API Projects
Need for Speed: Removing speed bumps in API ProjectsNeed for Speed: Removing speed bumps in API Projects
Need for Speed: Removing speed bumps in API Projects
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
 
WSO2Con EU 2015: Extending and Customizing WSO2 API Manager
WSO2Con EU 2015: Extending and Customizing WSO2 API ManagerWSO2Con EU 2015: Extending and Customizing WSO2 API Manager
WSO2Con EU 2015: Extending and Customizing WSO2 API Manager
 
Cloud native programming model comparison
Cloud native programming model comparisonCloud native programming model comparison
Cloud native programming model comparison
 
Serverless archtiectures
Serverless archtiecturesServerless archtiectures
Serverless archtiectures
 
Rest with Spring
Rest with SpringRest with Spring
Rest with Spring
 

Dernier

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
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
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
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
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
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
 
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
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Dernier (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
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
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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
 
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
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
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!
 
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
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

JAX-RS 2.0 New Features

Notes de l'éditeur

  1. \n
  2. I am Jan Algermissen\nComplete REST Head\nWorking as consultant based in Hamburg, Germany. By now Fulltime REST\nSo I am a happy person :-)\nStanding here because I happen to be part of the JAX-RS expert group.\n\nFirst, I owe you an apology because the abstract of the talk...\nI am around all week. If you feel like discussing real world REST systems drop me a line and I'll make it up to you.\n
  3. Before hitting a key:\nLet's learn about you:\n- who knows JAX-RS, who doesn't? To those, I apologize, I'll not cover the JAX-RS 1 features\n- who is active user?\n- and anybody considers herself a power user?\n- finally: any \n- Talking about jax-rs 2.0 new features\n- Who is user? Who would consider himself\n- I will briefly show the main aspects\n- found implications quite unintuitive at times\n- and not blogged about much, so far. not much out there to learn\n- thus, my goal here is to provide you with enaough detail so you get away\n with an understanding of how to approach the new API. How its olves problems\n you are facing and what new ideas you might have based on th ecapabilities.\nAFTER BUILT IN:\nGoing to take you on a wild tour through the new features.\nAlso help you develop a base for exploring what's possible. Help you develop new ideas.\n\n
  4. Before hitting a key:\nLet's learn about you:\n- who knows JAX-RS, who doesn't? To those, I apologize, I'll not cover the JAX-RS 1 features\n- who is active user?\n- and anybody considers herself a power user?\n- finally: any \n- Talking about jax-rs 2.0 new features\n- Who is user? Who would consider himself\n- I will briefly show the main aspects\n- found implications quite unintuitive at times\n- and not blogged about much, so far. not much out there to learn\n- thus, my goal here is to provide you with enaough detail so you get away\n with an understanding of how to approach the new API. How its olves problems\n you are facing and what new ideas you might have based on th ecapabilities.\nAFTER BUILT IN:\nGoing to take you on a wild tour through the new features.\nAlso help you develop a base for exploring what's possible. Help you develop new ideas.\n\n
  5. Before hitting a key:\nLet's learn about you:\n- who knows JAX-RS, who doesn't? To those, I apologize, I'll not cover the JAX-RS 1 features\n- who is active user?\n- and anybody considers herself a power user?\n- finally: any \n- Talking about jax-rs 2.0 new features\n- Who is user? Who would consider himself\n- I will briefly show the main aspects\n- found implications quite unintuitive at times\n- and not blogged about much, so far. not much out there to learn\n- thus, my goal here is to provide you with enaough detail so you get away\n with an understanding of how to approach the new API. How its olves problems\n you are facing and what new ideas you might have based on th ecapabilities.\nAFTER BUILT IN:\nGoing to take you on a wild tour through the new features.\nAlso help you develop a base for exploring what's possible. Help you develop new ideas.\n\n
  6. Before hitting a key:\nLet's learn about you:\n- who knows JAX-RS, who doesn't? To those, I apologize, I'll not cover the JAX-RS 1 features\n- who is active user?\n- and anybody considers herself a power user?\n- finally: any \n- Talking about jax-rs 2.0 new features\n- Who is user? Who would consider himself\n- I will briefly show the main aspects\n- found implications quite unintuitive at times\n- and not blogged about much, so far. not much out there to learn\n- thus, my goal here is to provide you with enaough detail so you get away\n with an understanding of how to approach the new API. How its olves problems\n you are facing and what new ideas you might have based on th ecapabilities.\nAFTER BUILT IN:\nGoing to take you on a wild tour through the new features.\nAlso help you develop a base for exploring what's possible. Help you develop new ideas.\n\n
  7. Before hitting a key:\nLet's learn about you:\n- who knows JAX-RS, who doesn't? To those, I apologize, I'll not cover the JAX-RS 1 features\n- who is active user?\n- and anybody considers herself a power user?\n- finally: any \n- Talking about jax-rs 2.0 new features\n- Who is user? Who would consider himself\n- I will briefly show the main aspects\n- found implications quite unintuitive at times\n- and not blogged about much, so far. not much out there to learn\n- thus, my goal here is to provide you with enaough detail so you get away\n with an understanding of how to approach the new API. How its olves problems\n you are facing and what new ideas you might have based on th ecapabilities.\nAFTER BUILT IN:\nGoing to take you on a wild tour through the new features.\nAlso help you develop a base for exploring what's possible. Help you develop new ideas.\n\n
  8. Before hitting a key:\nLet's learn about you:\n- who knows JAX-RS, who doesn't? To those, I apologize, I'll not cover the JAX-RS 1 features\n- who is active user?\n- and anybody considers herself a power user?\n- finally: any \n- Talking about jax-rs 2.0 new features\n- Who is user? Who would consider himself\n- I will briefly show the main aspects\n- found implications quite unintuitive at times\n- and not blogged about much, so far. not much out there to learn\n- thus, my goal here is to provide you with enaough detail so you get away\n with an understanding of how to approach the new API. How its olves problems\n you are facing and what new ideas you might have based on th ecapabilities.\nAFTER BUILT IN:\nGoing to take you on a wild tour through the new features.\nAlso help you develop a base for exploring what's possible. Help you develop new ideas.\n\n
  9. Client API has been there in the frameworks in proprietary form.\nPrimary benefit really is the consolidation into a standardized API.\n\nMost of you are likely familiar with the concepts, but some of it yields interesting aspects.\n
  10. Generic client\nNeed to register providers\nSupport for Apache client will be interesting with 2.0\n
  11. Various ways to create WebTargets\nNew instance every time\n\n-> Sometimes you need many of a kind; WTs support URI temaplates.\n
  12. \n
  13. \n
  14. Entity class used to determine request media type\n
  15. General and built in entity functions\n
  16. Suppose you are doing the same over and over again...\n
  17. Better to reuse the thing to invoce\n\n=> but sometimes you need variations of a request\n
  18. In the fluid API of clients side request building is InvocationBuilder\n\nWe can use that to 'parameterize' invocations.\n
  19. Also applies when we have different request bodies in turns\n
  20. Creates a WebTraget using built in client\n\nrelative URI references are resolved relative to the JAX-RS runtime application path.\n\nNot sure how useful such self-WebTargets are.\n\nClient should be configurable in runtime impl. dependent way\n
  21. Creates a WebTraget using built in client\n\nrelative URI references are resolved relative to the JAX-RS runtime application path.\n\nNot sure how useful such self-WebTargets are.\n\nClient should be configurable in runtime impl. dependent way\n
  22. \n\n
  23. \n\n
  24. \n\n
  25. \n\n
  26. \n\n
  27. \n\n
  28. \n\n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. PreMatching filters can change the input to the matching algorithm\n
  48. Request filters can abort processing of the filter chain and return directly.\n
  49. \n
  50. Now let us write a compressing filter\n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. Architectural Mismatch!\n
  63. Architectural Mismatch!\n
  64. Architectural Mismatch!\n
  65. Architectural Mismatch!\n
  66. Architectural Mismatch!\n
  67. Architectural Mismatch!\n
  68. Architectural Mismatch!\n
  69. Architectural Mismatch!\n
  70. => That's actually not even the whole story because if you change the stream you are always in danger of producing incorrect HTTP messages.\n
  71. Unfortunately that is only half of the problem.\n\nWhen changing the stream you are working around HTTP content negotiation.\n\nConsider Accept-Language and translating the stream in an interceptor.\n\nMuch like compressing it - actually, the runtime is in charge of conneg.\n\nConsider this:\n
  72. \n
  73. \n
  74. \n
  75. Client request headers not accessable ... until ResourceContext\n\nHaving said that, the advice is:\n
  76. Having said that, here is one more example.\n\n
  77. Here is an example that does not have these issues because it holds the stream and can then change the headers.\n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. Why do we have both, what is the difference, really? This sums it up.\n\n
  86. Why do we have both, what is the difference, really? This sums it up.\n\n
  87. Why do we have both, what is the difference, really? This sums it up.\n\n
  88. Why do we have both, what is the difference, really? This sums it up.\n\n
  89. Why do we have both, what is the difference, really? This sums it up.\n\n
  90. Why do we have both, what is the difference, really? This sums it up.\n\n
  91. Why do we have both, what is the difference, really? This sums it up.\n\n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. So, how do filters and interceptors get associated with the chains?\nTwo differnt sides: server side (managed by JAX-RS runtime) and client side (explicit registering)\nconstrained to, named binding, feature, dynamic feature, global\nAchtung bei binding (bind instance, bind class (that is: bind the singleton) and maybe limit bind to a certain contract interface (iow not all implemented interfaces of the registered provider\n\n
  99. Use @Provider to have runtime detect them. bound to all stuff per default\nYou can not use @Provider and register with ApplicationConfig instead but that is uncommen IMO\n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. configure() is called in turn for every resource and resource method\n\nYour implementation must decide what to register for each of them.\n\nTaking into account whatever other parameters there are (e.g. debug=true)\n
  107. You can provide class *or* instance.\n\nProvide class means: use or create a managed instance\n\nProvide instance creates a dedicated, not(!) managed instance. DI won't work in there\n
  108. Use @Provider to have runtime detect them. bound to all stuff per default\nYou can not use @Provider and register with ApplicationConfig instead but that is uncommen IMO\n
  109. register() changes target object\nconfiguration is inherited\ndeep copy is made\n
  110. register() changes target object\nconfiguration is inherited\ndeep copy is made\n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. => Of course, now there immediately arise the question: "What about the client side?"\n
  124. Beware that you might loose events - this is not guaranteed delivery\n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n
  134. fromMethod() will not survive renamings\n
  135. fromMethod() will not survive renamings\n
  136. \n
  137. \n
  138. \n
  139. \n
  140. \n\n
  141. \n\n
  142. \n\n
  143. \n\n
  144. 1.1 - Subresource locator has no DI\n
  145. 1.1 - Subresource locator has no DI\n
  146. \n
  147. \n
  148. \n
  149. Same works for interceptors, of course\n
  150. \n
  151. One final remark: won't work in PreMatching filters.\n
  152. \n\n
  153. \n\n
  154. \n\n
  155. Advice: interceptors just monitoring etc.\n
  156. Advice: interceptors just monitoring etc.\n
  157. Advice: interceptors just monitoring etc.\n
  158. Advice: interceptors just monitoring etc.\n
  159. Advice: interceptors just monitoring etc.\n
  160. Advice: interceptors just monitoring etc.\n
  161. Advice: interceptors just monitoring etc.\n
  162. Currently API is still changing a bit.\nI'll put together a blog this week containing links and how to try the latest in an EE context with GF.\n\n\n
  163. Mention slides uploaded and links/more info in blog\nOrder QA by aspects.\n