Main Menu
Lecture 1
Lecture 2
Lecture 4
Lecture 5
Lecture 6
Lecture 7
 

 

 

Request Response Cycle

Now the application is ready to process individual user requests

Several messages in a complete request-response cycle

Three messages always occur

  1. awake()
  2. appendToResponse()
  3. sleep()
In addition
  • takeValuesFromRequest() is sent when the user submits a form
  • invokeAction() is sent when the user clicks a hyperlink etc
These messages are sent to all 3 objects involved in servicing the request
  1. Application
  2. Session
  3. Active Component

All 3 classes inherit default versions of these methods

Framework methods awake() and sleep() do nothing so you don't have to call super

Must call super when you override appendToResponse() and takeValuesFromRequest()

You can't overide invokeAction()

To display the message time line, we have overriden the messages in Application, Session and Main classes in

 

public void awake() {
//sent at the start of every request-response cycle
System.out.println(" Application awake");
}

public void appendToResponse(WOResponse r, WOContext c) {
//builds the html
super.appendToResponse(r, c);
System.out.println(" Application append to response");
}

public void sleep() {
System.out.println(" Application sleep");
}

public void takeValuesFromRequest(WORequest r, WOContext c) {
//sent when a form is submitted by user
super.takeValuesFromRequest(r, c);
System.out.println(" Application take values from request");
}