NOTE:
These slides have not been updated since 2003. They have been superseded by the book
Anders Møller and Michael Schwartzbach, February 2006 |
INTERACTIVE WEB SERVICES WITH JAVA |
The three checks guarantee that:
import dk.brics.jwig.runtime.*; public class Greetings extends Service { String greeting = null; public class Welcome extends Session { XML cover = [[ <html> <head><title>Welcome</title></head> <body bgcolor=[color]> <{ if (greeting==null) return [[ <em>Hello World!</em> ]]; else return [[ <b><[g]></b> ]] <[g=greeting]; }> <[contents]> </body> </html> ]]; XML getinput = [[ <form>Enter today's greeting: <input type="text" name="salutation"/> <input type="submit"/> </form> ]]; XML message = [[ Welcome to <[what]>. ]]; public void main() { XML h = cover<[color="white",contents=message]; if (greeting==null) { show cover<[color="red",contents=getinput]; greeting = receive salutation; } exit h<[what=[[<b>BRICS</b>]]]; } } } |
the analyzer goes through eight phases:
The possible documents being shown at the exit statement are then approximated by a summary graph:
No errors are found, in this case.
The key idea is the notion of summary graphs: a summary graph approximates the set of XML templates that may appear at a given program point for a given variable or expression.
COPYRIGHT © 2002-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH |