AJAX Use Cases for WSRP Subbu Allamaraju BEA Systems Inc WSRP F2F Meeting, May 2006.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Introduction to Ajax.
Advertisements

MWD1001 Website Production Using JavaScript with Forms.
Java Script Session1 INTRODUCTION.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
IBM WebSphere Portal © 2008 IBM Corporation 1 Deliver an Irresistible User Experience  Provides an interactive user experience  No programming needed,
Project 1 Introduction to HTML.
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
Wesley Budziwojski Senior Architect Sun ONE Portal Server Web Services for Remote Portlets, WSRP Jun/2003.
Servlets and a little bit of Web Services Russell Beale.
1 Cleaning up the Internet Using AJAX, SOAP and Comet CS526 Mike Gerschefske Justin Gray James Yoo 02 May 2006.
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
World Wide Web1 Applications World Wide Web. 2 Introduction What is hypertext model? Use of hypertext in World Wide Web (WWW) – HTML. WWW client-server.
Macromedia Dreamweaver 4 Advanced Level Course. Add Rollovers Rollovers or mouseovers are possibly the most popular effects used in designing Web pages.
Does Ajax suck? CS575 Spring 2007 Chanwit Suebsureekul.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
5/3/2006 Mike/Justin/JYoo AJAX/SOAP/Comet 1 Cleaning up the Internet Using AJAX, SOAP and Comet CS526 Mike Gerschefske Justin Gray James Yoo 02 May 2006.
1 JavaScript & AJAX CS , Spring JavaScript.
HTML 1 Introduction to HTML. 2 Objectives Describe the Internet and its associated key terms Describe the World Wide Web and its associated key terms.
Chapter ONE Introduction to HTML.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
JS: DOM Form Form Object Form Object –The Form object represents an HTML form. –For each instance of a tag in an HTML document, a Form object is created.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Ajax (Asynchronous JavaScript and XML). AJAX  Enable asynchronous communication between a web client and a server.  A client is not blocked when an.
1 Ajax. 2 What’s Ajax? AJAX is a combination of a few technologies that has come together in the past few years AJAX used to be an acronym for Asynchronous.
May 16 – 18, 2007 Copyright 2007, Data Access Worldwide May 16 – 18, 2007 Copyright 2007, Data Access Worldwide Build Great Web Application 'Fast and Easy'
1 Forms A form is the usual way that information is gotten from a browser to a server –HTML has tags to create a collection of objects that implement this.
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
Server-side Scripting Powering the webs favourite services.
 2008 Pearson Education, Inc. All rights reserved Ajax-Enabled Rich Internet Applications.
© Cheltenham Computer Training 2001 Macromedia Dreamweaver 4 - Slide No 1 Macromedia Dreamweaver 4 Advanced Level Course.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Copyright 2007 Adobe Systems Incorporated. 1 ColdFusion 8 : Advanced AJAX Development Rakshith N Computer Scientist Jan 02, 2008.
Understanding AJAX Hype, Hope, Hurt and Help for the Web MJTS May 4th, 2006 _________________________ Terence Conklin, Conklin Systems
Cross Site Integration “mashups” cross site scripting.
Proposal to Address AJAX Use Cases in WSRP Subbu Allamaraju BEA Systems Inc WSRP F2F Meeting, May 2006.
Chapter 6 Server-side Programming: Java Servlets
Ventsislav Popov Crossroad Ltd.. 1. What is AJAX?  AJAX Concept  ASP.NET AJAX Framework 2. ASP.NET AJAX Server Controls  ScriptManager, UpdatePanel.
Proposal to Address AJAX Use Cases in WSRP Subbu Allamaraju BEA Systems Inc WSRP F2F Meeting, May 2006.
Building Rich Web Applications with Ajax Linda Dailey Paulson IEEE – Computer, October 05 (Vol.38, No.10) Presented by Jingming Zhang.
Telerik Software Academy ASP.NET Web Forms Telerik Software Academy ASP.NET Web Forms.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
® IBM Software Group © 2007 IBM Corporation Best Practices for Session Management
AJAX Compiled from “AJAX Programming” [Sang Shin] (Asynchronous JavaScript and XML)
Fall 2006 Florida Atlantic University Department of Computer Science & Engineering COP 4814 – Web Services Dr. Roy Levow Part 2 – Ajax Fundamentals.
Ajax. –Asynchronous JavaScript and XML –Umbrella term for technologies that often: Use client-side scripting for layout and formatting Use less than full.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
Web Technologies Lecture 3 Web forms. HTML5 forms A component of a webpage that has form controls – Text fields – Buttons – Checkboxes – Range controls.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
NASRULLAH KHAN.  Lecturer : Nasrullah   Website :
1 State and Session Management HTTP is a stateless protocol – it has no memory of prior connections and cannot distinguish one request from another. The.
HTML Concepts and Techniques Fifth Edition Chapter 1 Introduction to HTML.
AJAX. Overview of Ajax Ajax is not an API or a programming language Ajax aims to provide more responsive web applications In normal request/response HTTP.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
July 28, 2004WSRF Technical Committee F2F meeting1 WSRP leveraging WSRF Use case for Portlets as WS-Resources.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
 AJAX technology  Rich User Experience  Characteristics  Real live examples  JavaScript and AJAX  Web application workflow model – synchronous vs.
Web Services Essentials. What is a web service? web service: software functionality that can be invoked through the internet using common protocols like.
CITA 330 Section 10 Web Remoting Techniques. Web Remoting Web Remoting is a term used to categorize the technique of using JavaScript to directly make.
Open Solutions for a Changing World™ Eddy Kleinjan Copyright 2005, Data Access WordwideNew Techniques for Building Web Applications June 6-9, 2005 Key.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
AJAX and REST.
Subbu Allamaraju BEA Systems Inc
AJAX – Asynchronous JavaScript and XML
AJAX.
AJAX Robin Burke ECT 360.
Cross Site Request Forgery (CSRF)
Presentation transcript:

AJAX Use Cases for WSRP Subbu Allamaraju BEA Systems Inc WSRP F2F Meeting, May 2006

Agenda Overview of AJAX Use cases Common use cases Implementing using WSRP 1.0 Implementing using WSRP 2.0 Summary

Overview of AJAX Asynchronous JavaScript And XML Interaction Model Requests and responses through an XMLHttpRequest object in the browser Typically asynchronous Request triggered by browser events or user interactions On various browser events, such as page reload, timer, control navigation etc. Explicitly on user interactions, such as link clicks, form submissions etc. Requests sent over HTTP GET or POST requests Response may be markup or data Accessed as XML or text Response handed over to a JavaScript callback Callback processes data

Example var request =...; // Browser specific request.onreadystatechange = function() { if(request.readyState == 4) { if(request.status == 200) { var response = request.responseXML; // Process response } }; request.open('GET', url, true); request.send(null); Requests typically cause partial page changes Browser does some level of aggregation Browser aggregates data/markup returned via XMLHttpRequest State encoded in other parts of the page may become stale

Standardization Not currently a standard IE uses an ActiveX control (IE7 supports natively) Other browsers provide native implementations Not all implementations support the same set of attributes and callback handlers W3C Web API WG Currently focused on providing a standard interface Mainly concerned about standardizing commonalities across current implementations in browsers

Alternatives Remote scripting via hidden IFRAMEs is a popular alternative For GET requests Create a URL with query params, Create a hidden IFRAME Set the URL as the src of an IFRAME For POST requests Create a hidden IFRAME with a FORM Submit the FORM through JavaScript Server can return script as well as data Works well on legacy browsers Other alternatives Flash, Java applets, Active X etc.

Use Cases

UC1: Fetch Data Portlet embeds JavaScript in the markup Submits a GET request to the server Server returns an XML document containing the list of city codes Portlet updates the UI with the data User navigates to a drop-down list, and the browser fetches a list of city codes from the server

UC1 with WSRP Portlet embeds JavaScript in its markup Portlet uses a resource URL to submit data to the server Can not use render URLs – render URLs may cause full page refresh Resource URL must be rewritten by Consumer To serve AJAX requests [WSRP 1.0] Portlet provides an HTTP end point to serve AJAX requests Not part of the same portlet Does not have access to the portlet’s context or state – may have to embed all the context required within resource URLs [WSRP 2.0] Portlet uses getResource to serve AJAX requests Has access to the portlet’s context and state

UC2: Update Portlet Markup Portlet embeds JavaScript in the markup Submits a GET request to the server Server returns HTML markup Markup may contain rewritable content such as links and prefixes Links in the markup do not use AJAX, and may cause full page downloads Portlet updates the UI with the markup User enters country code in a form, and the browser expands the form to fill in more details. Links in the expanded markup do not use AJAX.

UC2 with WSRP Portlet uses a resource URL to submit data to the server To serve AJAX requests [WSRP 1.0] Portlet provides an HTTP end point to serve AJAX requests Encodes WSRP rewrite tokens in the return markup Generated links can be action, render or resource URLs Consumer proxy rewrites the markup Consumer proxy will have to rewrite action/render URLs to cause regular interactions with the Consumer’s aggregated page Do Consumers support this? [WSRP 2.0] Portlet uses getResource to serve AJAX requests Portlet can generate URLs and prefixes Use producer writing or consumer rewriting Generated links can be action, render or resource URLs Rewritten links can be used to interact with the consumer’s aggregated pagte

UC3: Update Portlet Markup Portlet embeds JavaScript in the markup Submits a GET request to the server Server returns HTML markup Markup may contain rewritable content such as links and prefixes Portlet updates the UI with the markup User continues to interact with the new markup. Those interactions use AJAX. User enters country code in a form, and the browser expands the form to fill country-specific markup with links. Links in this markup use AJAX to further update markup/data in the browser.

UC3 with WSRP Portlet must use a resource URL to submit data to the server To serve AJAX requests [WSRP 1.0] Portlet provides an HTTP end point to serve AJAX requests Embeds WSRP rewrite tokens in the return markup Generated links must all be resource URLs Consumer proxy rewrites the markup Any state encoded in resource URLs must be copied to new URLs created [WSRP 2.0] Portlet uses getResource to serve AJAX requests Portlet can generate URLs and prefixes Use producer writing or consumer rewriting Generated links must all be resource URLs

UC4: Submit Data Using AJAX Portlet embeds JavaScript in the markup Submits a POST request to the server Server returns HTML markup Markup contain rewritable content such as links and prefixes Form submissions cause further AJAX requests Portlet updates the UI with the markup Portlet requires a user to enter data in several forms in sequence. Each form submission uses AJAX to submit the request, and fetch the next form.

UC4 with WSRP Portlet must use resource URLs for form submissions Use case warrants interaction URLs – but interaction URLs may cause full page refresh. Can not use action URLs URLs can not include interaction state Portlet must encode interaction state into hidden form fields or the resource URL or the resource ID To serve AJAX requests [WSRP 1.0] Portlet provides an HTTP end point to process form submissions Generated links must all be resource URLs [WSRP 2.0] Portlet uses getResource to serve AJAX requests Portlet can not process the request as a blocking interaction Portlet can not ask for mode/state changes Portlet can not update its own navigational state Portlet can not update shared state Portlet can fire/consume events

UC5: Page Navigation Portlet uses AJAX to process several forms. Each form submission uses AJAX to submit the request, and fetch the next form. Portlet provides links to navigate to previous form and next form. A flavor of UC5 Links to previous and next forms include state to render/fetch the previous or next form

UC5 and WSRP Use case warrants for using navigationalState to manage portlet’s view state Not possible with resource URLs But when encoded so, navigational state encoded outside the updated markup may become stale Portlet can not use navigationalState to manage its current view Portlet may lose its current state When the user interacts with another portlet on the same page When the user refreshes the page Portlet must manage its own state Using cookies – cookies set via resources may not reach the browser. When reached, cookies may not be valid per RFC 2965 rules Using sessions – resource end point (WSRP 1.0) or the portlet (WSRP 2.0) may store the state in the session

UC6: Modal Popup User clicks on a balance transfer link in a banking portal. Browser opens a modal dialog simulated via HTML div tags and JavaScript. User selects accounts, and does a balance transfer. Upon completing the transfer, browser closes the dialog, and updates account summary portlet. Combines various flavors of previous use cases Uses events to cause account summary updates. Events can not be raised during resource requests Not supported by WSRP 1.0 and WSRP 2.0.

UC7: Online Collaboration Portlet wants to provide a collaborative quick note system. Portlet uses a combination of polling and server push using long-lived connections. The producer or the portlet provides for such collaboration. Portlet uses AJAX and/or remote scripting to deliver data to the browser Portlet can use a HTTP resource end point or getResource to return data

Summary

WSRP 1.0 Limitations AJAX requests can not participate in the two-phase life cycle Bypasses normal consumer-producer interactions Must use resource URLs to serve AJAX requests Producer must deploy an HTTP end point for AJAX requests Portlets don’t receive portlet’s context or state Such info may be managed within a session on the Producer Portlet can explicitly set its state and context in the request, and encode a key to that state in resource URLs. Portlets must use WSRP rewrite tags for getting return markup to be rewritten Portlets cannot make changes that are otherwise possible during performBlockingInteraction.

WSRP 2.0 Limitations AJAX requests can not participate in the three-phase life cycle Portlets must use resource URLs to serve AJAX requests Deploy a HTTP end point in the WSRP 1.0 style Or use getResource operation Portlets receive portlet’s context or state, but may have to manage additional navigation state in a session Portlets cannot make changes that are otherwise possible during performBlockingInteraction and handleEvents

Requirements Summary Portlet need to embed JavaScript in its markup Potential duplication of the script in each markup fragment Resource URLs address only a few use cases Consumer and Producer must fully participate in serving AJAX requests Be able to support state changes Be able to participate in the three-phase life cycle Be able to update state stored in URLs in the browser Responses be cacheable

Some Common Work-arounds Use a new window state Portlets add a new window state to URLs and use that to submit AJAX requests Use a special URL parameter Portlets add a new URL parameter to indicate to Consumers that the response must not be aggregated Limitations New window state applies to the entire portlet’s markup – not just to a part of the portlet’s markup Consumers can’t push their state to the browser Consumers won’t be able to update state stored in the browser (e.g. in URLs) outside the portlet’s markup Consumers may be able to process events, but can’t update other portlets’ markup without a further page refresh or polling