Download presentation
Presentation is loading. Please wait.
Published byBertram Gray Modified over 9 years ago
1
Migrating Web Frameworks Using Water Transformations Ahmed E. Hassan Richard C. Holt School of Computer Science University Of Waterloo
2
Web Applications A software system whose functionality is delivered through the web Web browser is used as the client HTTP state-less protocol is used as the communication protocol Many development frameworks have been proposed – JSP, NSP, ASP, ASP+, CF Active pages are their building blocks
3
Introduction to Active Pages Simple html file: (foo.html) Welcome to CNN.COM AP file: (foo.ap) Welcome to
4
Introduction to Active Pages Interesting AP file: (foo2.ap) Welcome to
5
Introduction to Active Pages file.apfile.html Data Tables COM/ CORBA Objects Web Server Pre-processor Data Flow
6
Structure of an Active Page Active Page Client ScriptsServer ScriptsHTML JavaScriptPerlVBScript JavaScript
7
Web Application Development Frameworks Abstract details of developing an application: –access control –client state maintenance –relational database access –file manipulations on the server Each framework: –uses its own programming language –Each framework provides a set of built-in objects
8
Migrating from ASP to NSP Language Transformation: –ASP uses VBScript –NSP uses JavaScript Object Model Transformation: –Different set of built-in objects
9
ASP vs NSP built-in objects CanonicalASPNSP Request Response Session Client Application Project Server ErrorASPErrorSsjs_onError
10
ASP Example 1: 2: Main Page 3: 4: Welcome to your account, 5: To display balance click here 6: 7: Please Login first, click here 8: 9:
11
Island Grammars Used for robust parsing and extraction Recover from errors and handle ill defined grammars: –Island: Tokens of interest (VBScript Code) Parsed and expanded –Water: Un-interesting tokens (HTML/Comments) Skipped
12
Water Transformations Extends the idea of Island Grammars for code transformations Converts Water to special Islands Performs code transformation on Islands using traditional approaches Convert back the special post-transform. Islands to Water
13
Migration Overview rmComment (in Perl) rmHTML (in Perl) ASP file VBScript code Lang Trans. (in TXL) Object Model Trans. (TXL) addComment (in Perl) addHTML (in Perl) NSP file JavaScript code
14
1: 2: Main Page 3: 4: Welcome to your account, 5: To display balance click here 6: 7: Please Login first, click here 8: 9: 1: HTMLCALL(); 2: if Session("loggedIn") Then ‘ User already logged in 3: HTMLCALL(); 4: Response.Write(Session("username")) 5: HTMLCALL(); 6: Else ‘ User needs to login 7: HTMLCALL(); 8: End If 9: HTMLCALL(); Input ASP file After rmHTML
15
1: HTMLCALL(); 2: if Session("loggedIn") Then ‘ User already logged in 3: HTMLCALL(); 4: Response.Write(Session("username")) 5: HTMLCALL(); 6: Else ‘ User needs to login 7: HTMLCALL(); 8: End If 9: HTMLCALL(); 1 : HTMLCALL(); 2 : if Session("loggedIn") Then 3 : COMMENTCALL(); 4 : HTMLCALL(); 5 : Response.Write(Session("username")) 6 : HTMLCALL(); 7 : Else 8 : COMMENTCALL(); 9 : HTMLCALL(); 10: End If 11: HTMLCALL(); After rmCmt After rmHTML
16
1 : HTMLCALL(); 2 : if Session("loggedIn") Then 3 : COMMENTCALL(); 4 : HTMLCALL(); 5 : Response.Write(Session("username")) 6 : HTMLCALL(); 7 : Else 8 : COMMENTCALL(); 9 : HTMLCALL(); 10: End If 11: HTMLCALL(); 1 : HTMLCALL(); 2 : if (Client.loggedIn)) { 3 : COMMENTCALL(); 4 : HTMLCALL(); 5 : write(Client.username)) ; 6 : HTMLCALL(); 7 : } else { 8 : COMMENTCALL(); 9 : HTMLCALL(); 10: } 11: HTMLCALL(); After TXL Trans. After rmCmt
17
Conclusion An approach to migrate ASP to NSP is presented: –Language Transformation –Object Model Transformation Pre/Post processing steps are used to massage the input and transform it to a traditional program The approach preserves the location of the comments and HTML compared to the source code to ease future maintenance
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.