SlideShare a Scribd company logo
1 of 19
RESTful Services with JAX-RS, JQuery Bonus Content: JSF 2.0 Jeffrey West Application Grid Product Management
Questions & Discussion
<Insert Picture Here> Program Agenda JAX-RS / JQuery JAX-RS Introduction & Overview JAX-RS vs SOAP JAX-RS WebLogic Configuration JAX-RS Code Review JQuery Application Demo JQuery Code Review JSF 2.0 JSF 2.0 Application Demo JSF 2.0 Code Review
JAX-RS(Jersey) Programming Model Stub Resource JAX-RS  API JAX-RS  API Server Side Runtime System Client side Runtime System Protocol (REST/HTTP) Transport WADL Service Client Service Endpoint Container WADL<->Java Mapping Dispatch
REST – Representational State Transfer JSR-311: JAX-RS Exposes named RESOURCES which represent DATA Resource: POJO URI path template ID Uses simple Nouns (Resources) and verbs (HTTP Methods) GET/PUT/POST/DELETE Emphasis on simple, stateless point-to-point communication over HTTP Supports multiple data formats JSON/XML/TEXT/XHTML Runtime Content Negotiation ,[object Object]
@Path
@Produces/Consumes
@HEAD/PathParam/QueryParam
@GET/POST/PUT/DELETE,[object Object]
Example (Resource class)  @Path("widgets")@Produces("application/xml, application/json")public class WidgetsResource {@GETpublic WidgetsRepresentationgetWidgetList() {    ...  }@GET @Path("{id}")  public WidgetRespresentationgetWidget(@PathParam("id") String widgetId) {    ...  }}
REST vs. SOAP
SOAP – Simple Object Access Protocol Exposes OPERATIONS that implement/represent LOGIC Provides loose coupling for integrating diverse systems Designed for distributed computing Designed to be extensible – WS-* Standard error messaging – SOAP faults with standard Code/Subcode for error types Aligns with Enterprise Application needs and goals Supports other transport protocols than HTTP – SMTP, JMS Supports enterprise security with WS-Security Supports language neutrality Supports ACID, Atomic transactions with WS-AT Supports Reliable Messaging with WS-RM Easy governance with strong typing Broad Development Tools support
REST vs. SOAP REST Exposes RESOURCES which represent DATA Uses HTTP Verbs (GET/POST/DELETE) Emphasis on simple point-to-point communication over HTTP Supports multiple data formats Emphasizes stateless communication SOAP Exposes OPERATIONS which represent LOGIC Uses HTTP POST Emphasis on loosely coupled distributed messaging Supports only XML (and attachments) Supports stateless and stateful/conversational operations Supports asynchronous messaging Strong Typing
REST is better than SOAP! REST can be consumed by any client, even a web browser with Ajax and Javascript REST is lightweight REST doesn’t require XML parsing REST consumes less bandwidth – doesn’t require a SOAP header for every message SOAP is OLD!  All the ‘cool kids’ are using REST! Twitter, Google, Flickr I can learn to use REST very quickly It’s just nouns and verbs, how hard can it be? REST is SAFE! Aren’t all ‘GET’ operations safe?
SOAP is better than REST! Building a client for REST can be challenging I can easily generate client-side artifacts from a WSDL I don’t want to write raw HTTP calls I don’t want to look at the HTTP response code for success/failure – I want to use my own exception types and codes Many IDE’s support SOAP development – both client and server REST only supports HTTP/HTTPS HTTP is synchronous and in order to scale I need to be able to have asynchronous messaging REST is not secure Parameters as part of the URI No support for acquiring tokens RESTful services have no contract I have a WADL that specifies URL’s but what about schemas for object definition REST is not reliable I have to handle failures with retries – no Reliable Messaging REST can’t be governed How do I know who is consuming my services without a Service Registry? How do I discover RESTful services?
Both SOAP and REST have their rightful places REST Good for: Web Services Limited bandwidth (smaller message size) Limited resources (no xml parsing required)  Exposing data over the Internet Combining content from many different sources in a web browser SOAP Good for: Enterprise services High Reliability with WS-RM Transactions with WS-AT Security with WS-Security Asynchronous processing Contract-first development Stateful /conversational operations Standards support, interoperability with business applications Tooling Support
Oracle Parcel Service
Oracle Parcel Service

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

WebLogic Developer Webcast 4: RESTful Services with JAX-RS, JQuery and JSF 2.0

  • 1.
  • 2. RESTful Services with JAX-RS, JQuery Bonus Content: JSF 2.0 Jeffrey West Application Grid Product Management
  • 4. <Insert Picture Here> Program Agenda JAX-RS / JQuery JAX-RS Introduction & Overview JAX-RS vs SOAP JAX-RS WebLogic Configuration JAX-RS Code Review JQuery Application Demo JQuery Code Review JSF 2.0 JSF 2.0 Application Demo JSF 2.0 Code Review
  • 5. JAX-RS(Jersey) Programming Model Stub Resource JAX-RS API JAX-RS API Server Side Runtime System Client side Runtime System Protocol (REST/HTTP) Transport WADL Service Client Service Endpoint Container WADL<->Java Mapping Dispatch
  • 6.
  • 10.
  • 11. Example (Resource class) @Path("widgets")@Produces("application/xml, application/json")public class WidgetsResource {@GETpublic WidgetsRepresentationgetWidgetList() { ... }@GET @Path("{id}") public WidgetRespresentationgetWidget(@PathParam("id") String widgetId) { ... }}
  • 13. SOAP – Simple Object Access Protocol Exposes OPERATIONS that implement/represent LOGIC Provides loose coupling for integrating diverse systems Designed for distributed computing Designed to be extensible – WS-* Standard error messaging – SOAP faults with standard Code/Subcode for error types Aligns with Enterprise Application needs and goals Supports other transport protocols than HTTP – SMTP, JMS Supports enterprise security with WS-Security Supports language neutrality Supports ACID, Atomic transactions with WS-AT Supports Reliable Messaging with WS-RM Easy governance with strong typing Broad Development Tools support
  • 14. REST vs. SOAP REST Exposes RESOURCES which represent DATA Uses HTTP Verbs (GET/POST/DELETE) Emphasis on simple point-to-point communication over HTTP Supports multiple data formats Emphasizes stateless communication SOAP Exposes OPERATIONS which represent LOGIC Uses HTTP POST Emphasis on loosely coupled distributed messaging Supports only XML (and attachments) Supports stateless and stateful/conversational operations Supports asynchronous messaging Strong Typing
  • 15. REST is better than SOAP! REST can be consumed by any client, even a web browser with Ajax and Javascript REST is lightweight REST doesn’t require XML parsing REST consumes less bandwidth – doesn’t require a SOAP header for every message SOAP is OLD! All the ‘cool kids’ are using REST! Twitter, Google, Flickr I can learn to use REST very quickly It’s just nouns and verbs, how hard can it be? REST is SAFE! Aren’t all ‘GET’ operations safe?
  • 16. SOAP is better than REST! Building a client for REST can be challenging I can easily generate client-side artifacts from a WSDL I don’t want to write raw HTTP calls I don’t want to look at the HTTP response code for success/failure – I want to use my own exception types and codes Many IDE’s support SOAP development – both client and server REST only supports HTTP/HTTPS HTTP is synchronous and in order to scale I need to be able to have asynchronous messaging REST is not secure Parameters as part of the URI No support for acquiring tokens RESTful services have no contract I have a WADL that specifies URL’s but what about schemas for object definition REST is not reliable I have to handle failures with retries – no Reliable Messaging REST can’t be governed How do I know who is consuming my services without a Service Registry? How do I discover RESTful services?
  • 17. Both SOAP and REST have their rightful places REST Good for: Web Services Limited bandwidth (smaller message size) Limited resources (no xml parsing required) Exposing data over the Internet Combining content from many different sources in a web browser SOAP Good for: Enterprise services High Reliability with WS-RM Transactions with WS-AT Security with WS-Security Asynchronous processing Contract-first development Stateful /conversational operations Standards support, interoperability with business applications Tooling Support
  • 20. JQuery Client Side JavaScript designed to simplify JavaScript and create powerful & dynamic websites Eases the: Navigation of HTML documents Queries to select DOM elements Creation of Animations Handling of Events Development of AJAX based applications (which are aligned with consuming RESTful services) JQuery is one of the most popular JavaScript libraries uses today: http://trends.builtwith.com/javascript/JQuery Free, open-source MIT- and GNU-licensed
  • 21. JSF 2.0 Great Blog Post: http://andyschwartz.wordpress.com/2009/07/31/whats-new-in-jsf-2/#ajax Annotation-Driven Managed Bean Annotations Converter Annotations Composite Components Not required: UIComponent, Renderer, faces-config.xml Ajax support Navigation Implicit Navigation Conditional Navigation Project Stage: ‘Development’ provides more detailed error messaging (not just HTTP 500) Resource Libraries Loading ‘Libraries’ for CSS, Images, Etc
  • 22. PrimeFaces – www.primefaces.org “PrimeFaces is a lightweight open source component suite for Java Server Faces 2.0 featuring 100+ rich set of JSF components” Easy to use, good looking components Multiple themes

Editor's Notes

  1. Jersey is the reference implementation of JAX-RS and is the implementation that you will find in both WebLogic Server and GlassFish. Lets take a look at the programming model.First, if you stick with the best practices and the standard approach to REST you will create ‘services’ out of ‘resources’. At runtime, you will be able to generate a WADL which specifies the URIs and supported HTTP methods/verbs (GET, PUT, POST, DELETE) and you can use this to create client-side applications. The JAX-RS specification only provides details for server-side APIs but if you use Jersey then you can take advantage of the classes that it offers to consume REST services.Just like SOAP, the container will take care of mapping your data representation, whether it is in XML or JSON, to your Java POJOs. In addition, JAX-RS takes care of HTTP handshaking and allows you to perform content negotiation at runtime. Also, JAX-RS supports HTTP communication ONLY. There are no other transports supported.
  2. Evolution over XML-RPCAllowed you to get around firewalls with HTTPSimply put, a format for sending messages
  3. Lets take a look at the arguments that claim REST is better than SOAP.First, RESTful services are lightweight can be consumed by a wide variety of clients – from standalone Java applications to simple browser-based applications using JavascriptREST doesn’t require XML parsing so the CPU requirements are lower than SOAP and REST doesn’t require a SOAP envelope so the messages consume less bandwidthAnother argument is that SOAP is old and all of the ‘new’ or ‘cool’ sites on the internet use REST, and this is very true for many consumer-facing websites and web service providers.In addition, you can learn how to use REST very easily. Its just nouns and verbs – resources and HTTP methods. I don’t have to learn XML and SOAP just to interact with a service producerPlus, REST is safe. I can simply enable passthrough on HTTP GET’s and spend my effort looking at PUTs and DELETEs.
  4. Both SOAP and REST have their rightful place within enterprise and consumer applications, and there is no reason they can’t co-exist and support the same enterprise application. REST is ideally suited for exposing data over the internet (or networks in general) and has low bandwidth and CPU requirements. It’s also good for creating mashups of different content from various providers on a web page.However, if you look at the enterprise requirements for messaging, you may find that SOAP is a better fit because it offers enterprise features like High Reliability with WS-RM