From: Matt Feifarek <matt@da...> - 2003-01-31 16:09:31
.awake() gets all of the participators of a servlet to "wake up". Since
it's likely that they are already running (already having been
initialized) awake() is a place to get them ready to "do-their-thing" again.
But, you don't necessarily have to worry about that.
Awake is a good place to put code that you need to run on each servlet
before output begins; perhaps database queries or security checks, etc.
If you put an awake() in your servlet, just make sure to call the
awake() method of your superclass at some point, or your pages will
break. When doing that, it's a good idea to call the super FIRST, so all
the low-level stuff can get set up, and then do your own awake code.
From: Luke Opperman <luke@me...> - 2003-01-31 21:49:42
The awake/writeHTML/sleep cycle is a suggested structure for handling servlet
responses. As Matt F suggested, this is commonly used for doing non-output
tasks or preparing for output. These are defined in WebKit.Page, as part of the
In the standard Webkit.Page, this is used for setting up convenience
variables/functions self.response(), self.request(), etc. This is the main
reason you should always call your superclass' .awake() if you do additional
processing in awake().
Some people ignore this structure and create a fairly equivalent one all within
writeHTML/_respond, such as preWriteHTML and postWriteHTML. Basically this is
all just a suggested structure, that works for most people, but there's very
little in WebKit that would enforce your use of it.
Get latest updates about Open Source Projects, Conferences and News.