Previous | Next
WireHose Developers Guide

The session helper

Each session in a WireHose application has an associated WHSessionHelper instance, which handles session-specific WireHose properties. It is a "helper" class so you don't have to subclass WHSession to access WireHose features.

The session helper maintains knowledge of the current user and the object currently being edited. It also holds the current WireHose page rendering context, including the current layout and how to render particular items in various areas of assorted pages within the available layouts. WHSessionHelper also handles localization, browser sniffing, login cookie generation and the user's current search string.

Accessing the session helper

The session helper is stored in the session's dictionary. WHComponent, WHSession and WHDirectAction provide access to the session helper via the helper() method. You can access the session helper in your own classes by implementing the following method:

public WHSessionHelper helper() {
     WHSessionHelper helper = (WHSessionHelper)session().objectForKey(WHApplicationHelper.SessionHelperKey);
     if (helper == null) {
         helper = new WHSessionHelper(session());
         session().setObjectForKey(helper, WHApplicationHelper.SessionHelperKey);
     }
     return helper;
 }

Previous | Next