Web Oriented Object Framework

User Guide (Version 0.5b4)

User Guide (Version 0.5b4)

The controller object

In a MVC architecture, the controller is responsible for handling user generated events and requests. Each type of request is mapped to a specific method - an action - of a controller. The action method contains the application logic to appropriately handle the request. It is the responsibility of the application writer to implement the specific action methods for a controller.

In Woof!, the controller constructor is also responsible for selecting any view related settings, such as skins, stylesheets etc.

The Controller class tree

When an incoming request is mapped to a controller class and action method, Woof! instantiates a controller object of that class. All controller classes should be derived from the ApplicationController class. This is in turn derived from Controller which encapsulates all the common functionality required of a controller. Application writers should never directly modify Controller since that will cause conflicts with Woof! updates. Instead, if common enhanced functions are to be added to all controllers in the application, the changes should be made to class ApplicationController.

The controller object execution context

When a controller object is instantiated for a request, the base Controller class constructor sets up an execution context for the methods implementing the actions. It provides simple means for extracting parameters from the request, managing session context, cookie handling and generating HTTP headers. It also provides several procedures for common tasks such as URL generation and redirection.

The objects and commands that are made available in the execution context are summarized below and detailed in later sections.


The request object encapsulates the attributes of the received request and provides methods to retrieve them.


Conversely, the response object is used to build the response to be sent back to the client. The application should generally not directly manipulate this object.


The page object holds the content of the web page and may be built either directly or through Woof! templates.


Session data, which supplies context that distinguishes between interactions with different clients, is maintained in session object.


Parameters passed in the client request are accessible through the params object.


Any HTTP cookies sent in the client request can be retrieved through the icookies object.


The ocookies object contains the output cookies that are to be returned in the response to the client.


The flash object is used as transient storage to hold data that needs to persist only between consecutive client requests.


The env object stores the environment passed in by the Web server. Generally, applications should use the methods of the request object as it hides differences between web servers.


The headers object contains the HTTP headers that will sent in the response to the client.

The above objects are available within the action methods as well as in the templates since the latter also execute in the context of the controller object. In addition, the Controller class provides several other utility methods. Refer to its reference pages for more details.