Dave Johnson on open web technologies, social software and software development
Dave Johnson in Links
05:45AM Mar 16, 2004
Comments [0]
Tags:
Links
After some late night hacking sessions, I've been able to rip Cocoon's Control Flow component free of Cocoon. I removed all dependencies on Cocoon and Avalon and pared my standalone version of Control Flow down to only 14 classes and a couple of JavaScript functions.
Below is the simple JavaScript code that I'm using to test Control Flow. This code will eventually run on the server side and will send a web page to the user when it needs input. The forwardAndWait()
method puts the name of the page or Struts forward into a 'tray' object and suspends execution. Eventually, it will suspend execution of the script, call a JSP page or a Struts forward, and wait for the response to go out and the request to come back in.
function test(tray) { log.info("I called my script!"); forwardAndWait(tray, "page1.html"); log.info("I'm back in the script"); forwardAndWait(tray, "page2.html"); log.info("all done!"); }
Below is the code I'm using to run and test this script. Step #1 sets up the 'tray' that I use to get the forward name and continuation id out of the JavaScript world. I introduced the tray concept, and I don't really like it but I'm not sure how else to get the values I need out of JavaScript. Step #2 and #4 are the interesting bits. Step #2 calls the JavaScript method, which executes and then suspends the script execution inside the 1st JavaScript forwardAndWait() call. Step #4 resumes execution of the script using the continuation id found in the tray.
JavaScriptInterpreter interp = new JavaScriptInterpreter(); interp.initialize(); interp.register("C:\\allfiles\\scratch\\StrutsFlow\\src\\flow\\system.js"); interp.register("C:\\allfiles\\scratch\\StrutsFlow\\tests\\flow\\test.js"); Scriptable s = interp.enterContext(); // 1. setup tray param to hold forward List params = new LinkedList(); List tray = new LinkedList(); params.add(new Argument("tray", tray)); // 2. call function interp.callFunction("test", params); // 3. funcion suspended, now tray should contain forward name assertTrue(((String)tray.get(0)).equals("page1.html")); // and the continuation id String kontid = (String)tray.get(1); // 4. resume exection of script using that contination id interp.handleContinuation(kontid, new LinkedList()); // 5. function suspeded again, now tray should contain second forward name assertTrue(((String)tray.get(0)).equals("page2.html")); // 6. resume function, so it may complete execution kontid = (String)tray.get(1); interp.handleContinuation(kontid, new LinkedList()); interp.exitContext(s);
And below is the debug output from running the test code above.
JS-INFO: I called my script! JS-DEBUG: WK: Just Created New Continuation 4d281a763e7c1b3f5a7b4e244b2e224729112160 JS-INFO: I'm back in the script JS-DEBUG: WK: Just Created New Continuation 877d715e813c5a7c4e7f1a56612826332f528167 JS-INFO: all done!
Next, I'll try to implement the same NumberGuess example from the Control Flow tutorial, but with no Cocoon - only JSP and Servlets.
Dave Johnson in Java
06:54PM Mar 15, 2004
Comments [2]
Tags:
Java
Poised to become the preeminent--not to mention standard--Java Web application framework, JavaServer Faces is the next big thing for server-side Java. Come find out what all the fuss is about in this cutting-edge session given by a member of the JSF Expert Group. Learn what JSF has to offer, how it compares to Struts, and how you can start using it today.For more info and directions: TriJUG JSF Talk Announcement
Dave Johnson in Java
04:25AM Mar 15, 2004
Comments [5]
Tags:
Java
Dave Johnson in Java
05:44AM Mar 14, 2004
Comments [2]
Tags:
Java
Terence Parr, Enforcing Model-View Separation in Template Engines (PDF): Without exception, programmers espouse separation of logic and display as an ideal principle. In, practice, however, programmers and engine producers are loath to enforce separation, fearing loss of power resulting in a crucial page that they cannot generate while satisfying the principle.Excellent paper, found via Bill de hOra - a good read for any web developer.
Dave Johnson in Java
10:04AM Mar 09, 2004
Comments [0]
Tags:
Java
Dave Johnson in Links
11:44AM Mar 08, 2004
Comments [0]
Tags:
Links
Since the Roller 0.9.8.1 release, I have made a number of fixes in the stable ROLLER_098_BRANCH to support JRoller including: additional database indexes for performance, referential integrity fixes, and RSS encoding fixes. Rick Ross will be happy to hear that, with the latest round of fixes, I have finally killed the dayhits rollover bug. I have deployed Roller 0.9.8.2 to JRoller and if all goes well over the next 24 hours, I'll release it on SourceForge.
In other news: Roller 0.9.9 is progressing nicely and is probably less than a month off. See also: Roller's JIRA roadmap.
Dave Johnson in Roller
06:38AM Mar 07, 2004
Comments [0]
Tags:
Roller
Dave Johnson in Roller
06:23AM Mar 07, 2004
Comments [4]
Tags:
Roller
Abstract: Using Smalltalk to Redefine Web Development It would be hard to imagine a worse model for user interface development than HTTP. Would you use a GUI framework where every event from every widget in your application was handed to you at once, periodically, as a large hashtable full of strings? Where every time a single piece of data changed you had to regenerate a textual description of the entire interface? Where the event-based architecture was so strict that you couldn't ever, under any circumstances, open a modal dialog box and wait for it to return an answer?That's part of the abstract for a talk on Seaside, a Smalltalk and continuation based web application development framework (via James Robertson's blog). Seaside is one of many continuation based frameworks. The more I read about these frameworks the more I become convinced that the holy grail of web development lies in the castle of continuations. I've previously mentioned the two Java entries in the quest for the grail: RIFE and Cocoon ControlFlow. I need to find some time to investigate these frameworks and figure out how they relate, if at all, to JSP and JSF.
[...]
For all its limitations, the web is fast becoming the most important deployment platform for many classes of application. The Java, Perl, PHP, and .NET worlds, to name a few, are pursuing it agressively. Many of us are going to have to play their game -- but we don't have to play by their rules.
Dave Johnson in Java
08:35AM Mar 05, 2004
Comments [2]
Tags:
Java
Dave Johnson in Links
04:44PM Mar 01, 2004
Comments [0]
Tags:
Links
Dave Johnson in Roller
03:58PM Mar 01, 2004
Comments [6]
Tags:
Roller
Dave Johnson in General
12:10PM Mar 01, 2004
Comments [4]
Tags:
General
Dave Johnson in Blogging
04:28AM Mar 01, 2004
Comments [0]
Tags:
Blogging
Last weekend, my 7 year old son Alex, without any prompting from me - I swear, asked for his own weblog. Just about every day since, he has taken a little time after finishing his homework to do some blogging. He is not able to type very quickly, but he hunts down the keys he needs and gives each a solid tap. He can't spell all that well, but he is not afraid to spell things out phonetically. Luckily for him, his entries are so short that there is no need for formatting, but soon I imagine I'll have to set up a WYSIWYG editor for him or teach him some rudimentary HTML.
Andi and I have decided not to edit Alex's posts or correct his spelling and grammar errors. We want to be able to look back on his progress as a writer. We do sometimes add some notes in parentheses when his spelling is too hard to read. If you have read this far without hitting the back-button, then perhaps you are wondering just where Alex's weblog is. I keep it on a somewhat obscure server and to keep that server obscure, I'm not going to give you a link. Instead, I'm going to publish Alex's historic first week of weblog posts right here on my weblog. Enjoy!
Sunday - Locker dockers. Today I and my famliy went to mil brook hiy school. when we got home daddy lock us outside. flinliy we got in our home.I will see you soon today.
Saturday - duster busters. Today I got dust in my eyes in a tree. We watch a move (movie) of scooey-doo (scooby-doo). It is a good move.
Friday - too snowy. Today it is snowing 3 inchis high! We had a snowball fight. We made a fort. today linus has a weblog. Cats have a talie. Cats are diffrent colors. Luna is black and white. Cats have reytrackl clas (retractable claws).
Thursday - snowing. It is snowing outside! linus lovs the snow. I do too. How bowt you. Daddy said tomrrow we will have a snowball fight.
Tuesday - school. At school I had an ansebly (assemby) Linus got a reading t-shrit. Tonight Linus went to school to sing songs to their parints. I did not go.
Monday - school. Today I went to school. I made a clock that was coloerfull. It is filled up. I can not put one more coloer in it. then I got home. I cilmed a tree and made a amrgsc esit (emergency exit) if eneything hopons. last I did my homework. My homework for today was pick a book you have read. Then make a parugraph. I pick a book you have read. then make a pargragh. I picked the seakrits of droon (Secrets of Droon). Eric looks like harry potter in the move. My dad leat us see some of it. He is reading it too.
Sunday - My first weblog post. Today is my first day writing on a weblog. Today I went to my grandmother and grandpa's house. I got ice cream in the country. On the way home we played racer. How we play is if we pass cars we get points. Today we got 50 points.
I love it, but first, let me say that 1) I only locked Alex and Linus outside for a very short time and 2) the fact that we scored 50 points playing "racer" on the drive home from the country does not mean that I exceeded the speed limit at anytime. As you can probably tell, I'm a proud Daddy - a proud Daddy who will be reading his son's weblog very carefully.
Dave Johnson in Blogging
05:04PM Feb 29, 2004
Comments [6]
Tags:
blogging
family
Dave Johnson in Roller
01:24PM Feb 27, 2004
Comments [1]
Tags:
Roller
Bruce Williams Has 'RSS' really become so common that it no longer refers to a particular technical specification, but instead refers to blog syndication generally? Has it really joined the ranks of Kleenex and Xerox?Yep, that is correct. RSS has now joined the ranks of Kleenex, Xerox, and, I will add, Google. The original definition of RSS has now been overruled by common usage. RSS now means any sort of website or weblog syndication and in this new Atomic age, you'll find more and more people talking about their Atom RSS feeds.
Dave Johnson in Blogging
09:55AM Feb 27, 2004
Comments [0]
Tags:
Blogging
« Previous page | Main | Next page »