Previous | Next
WireHose Developers Guide

The application helper

WHApplicationHelper is a class that handles application-level WireHose functionality. All its methods are static, so you never instantiate or subclass it. Its primary responsibilities are providing access to system properties, initializing WireHose data structures, providing access to the application's layout dictionary, and handling access control. During startup, the application helper also controls whether and how WireHose will modify EOModels by automatically creating subentities for particular entities.See "Multiple affiliates and auto subentities" for more information about this feature.

Application startup

In response to WOApplication's ApplicationWillFinishLaunching notification, the application helper performs a number of initialization tasks. These include getting system properties, setting default values, and logging the values of WireHose-specific properties.

Once it has completed initialization, WHApplicationHelper posts an ApplicationHelperDidFinishInitializing notification to declare that it's now safe to access WireHose objects. This is the notification Hello World's Application.java listens for before importing and crawling feeds.

Customizing WHApplicationHelper

WHApplicationHelper provides a delegate interface so you can customize its behavior. It defines several methods which you can use to customize how users are logged in, how guest users get created, and whether or not a user can view, edit or delete objects.

Typically you'll set your application class as WHApplicationHelper's delegate, but any object can be a delegate. You don't need to implement all the methods in the interface or declare that your object implements the interface; WHApplicationHelper will only call the delegate methods you implement.

Customizing authentication

You can override how WireHose associates a user with a session by implementing a delegate method called userFromRequest. You can inspect whatever formvalues, cookies or headers you find in the request to determine the user to return. You can also control how guest users are created or fetched through the guestUserForAffiliate method.

Customizing access control

The various WireHose layout components, pages and direct actions will query WHApplicationHelper to determine if a user is allowed to view, edit or delete objects. You can implement the userCanViewObject, userCanEditObject and userCanDeleteObject delegate methods to override the default behavior. The filteredUserViewableObjects is also available so you can quickly filter entire arrays rather than single objects. Note that these methods will be called often, so they should have as little overhead as possible.


Previous | Next