// Java public Application() { super(); this.statisticsStore().setLogFile("/tmp/WebObjects.log", 1); ... }When a log file is set, WOStatisticsStore records all information returned by descriptionForResponse:inContext: to that log file at the end of each cycle of the request-response loop.
http://localhost/cgi-bin/WebObjects/MyWebApp.woa/-/WOStatsNote: You can access any component directly using a URL with this form.
Figure 38 shows a WOStats page.
// WebScript NSDictionary *myDict = [[[self application] statisticsStore] statistics]; // Java ImmutableHashTable myDict = this.application().statisticsStore().statistics;For a list of keys to this dictionary, see the WOStatisticsStore class specification in the WebObjects Class Reference.
To record extra information about a page, override descriptionForResponse:inContext: in your component.
For example, the HelloWorld example's Hello component could return the value of its visitorName instance variable along with the component name:
// WebScript HelloWorld Hello.m - (NSString *)descriptionForResponse:(WOResponse *)response inContext:(WOContext *)context { return [NSString stringWithFormat:@"%@/%@", [self name], visitorName]; } //Java HelloWorld Hello.java public String descriptionForResponse(Response response, Context 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 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.
Table of Contents Next Section