Previous | Next
WireHose Developers Guide

Bookmarkable URLs

WireHose has several featurs which enable your applications to have clean, bookmarkable URLs such as "/WireHoseDemo/MyHomePage" and still provide personalized sessions.

Cookies

WireHose applications don't store sessionIDs in the URL unless the user has disabled cookies in the browser. WireHose provides a mechanism for for automatically detecting whether cookies are enabled in a client's browser, and controlling whether session IDs are visible in URLs accordingly.

When called for the first time during a session, a WireHose direct action will check to see if cookies should be enabled. If necessary, the browser will be redirected to the GotCookies direct action, providing a session id in both the URL and via cookies. During the GotCookies direct action, the session's storesIDsInCookies and storesIDsInURLs are set appropriately, and another redirect is issued back to the original direct action.

Rewrite rules

WHHyperlink is a replacement for WOHyperlink which includes support for URL-rewriting similar to Apache's mod_rewrite. This rewriting is applied to URLs generated by your application rather than incoming browser requests as with mod_rewrite.

You can provide a perl-style regular expression that gets applied to the URL, providing an outgoing-URL counterpart to Apache's mod_rewrite (which is applied to incoming request URLs).

For example, this rule

s'cgi-bin/WebObjects/WireHoseTest.woa/wa/Drill(?:\\?path=|)'Resources/'

will transform a URL like

http://www.wirehose.com/cgi-bin/WebObjects/WireHoseTest.woa/wa/Drill?path=Local%2FNews

into

http://www.wirehose.com/Resources/Local/News

Most WireHose components which generate links to direct actions, such as WHTagDriller or WHNavigationBox, provide a rewriteRule binding. These bindings are usually resolved via the layout dictionary.


Previous | Next