Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > WebObjects Developer's Guide


Table of Contents Previous Section

Recording Extra Information

There may be occasions when you want to have the WOStatisticsStore object record more information than it usually does. For example, it may be useful to know the value of a certain component variable each time the page is accessed. This is most easily accomplished by overriding descriptionForResponse:inContext: in your component and having it return the desired information.

For example, the HelloWorld example's Hello component could return the value of its visitorName instance variable along with the component name:

// WebScript Hello.m
- (NSString *)descriptionForResponse:(WOResponse *)response inContext:(WOContext *)context {
return [NSString stringWithFormat:@"%@/%@",
[self name], visitorName];
}
//Java Hello.java
public String descriptionForResponse(WOResponse response, WOContext context) {
return new String(this.name() + visitorName);
}
The response component receives the descriptionForResponse:inContext: message after it receives the message appendToResponse:inContext:. The default implementation of descriptionForResponse:inContext: prints the page name. Unlike other methods invoked during the component action request-response loop, descriptionForResponse:inContext: is not sent to all components and dynamic elements on the page; it is sent only to the top-level response component.

Note that this method receives the response and context objects as arguments, just as appendToResponse:inContext: does. This means you can add such information as the HTTP header keys, or any other information recorded in these objects, to your description string. This description string is then appended to the log file in the CLFF format as discussed in "Maintaining a Log File".

When an application is deployed, a session object keeps in memory all these descriptions in the order their components were accessed by the session's user. When the session times out, three things happen:

Table of Contents Next Section