How do I remove the tool bar?

Set the value of "Deployment Mode" to true using the dispatcher editor in the application configuration. This can be also done programatically in the #initialize method of the application’s root component.

How do I access the initial request fields in my root component or task?

To access the initial request fields in a root component or task override #initialRequest:. You will get a request object as argument that you can ask for #fields.

How do I open a popup and answer a value to the caller?

To open a popup window you use #popupAnchor, which supports the same protocol as #anchor but opens the link in a new window. Instead of calling on self and thus replacing the parent, start a new render loop for the new window:

In your popup component PopupComponent add a link or submit button with a callback along the following lines:

PopupComponent>>renderContentOn:htmlhtmlanchorcallback:[selfsessionclosePopupAndContinue.selfanswer:Timenow];with:'Close and Answer'

This will close the window and return the object passed to #answer: to the caller WARenderLoop new call: PopupComponent new.

How do I clean up external resources owned by Seaside sessions?

When a Seaside session is not used during a certain duration, it expires. After a session has expired, it cannot be used any more.

By default, this duration is 10 minutes (600 seconds) but it can be set to any other desired value using the "config" application ("Session Expiry" field). It can also be set programmatically:

apppreferenceAt:#sessionExpirySecondsput:1200

From time to time, Seaside processes expired sessions (see #unregisterExpiredHandlers). Expired sessions are removed from Seaside, making them candidates for future garbage collections, then they are sent #unregistered. The standard implementation of #unregistered in WASession is empty.

If it is necessary to release resources held by an expired Seaside session, this can be done by subclassing WASession and by reimplementing the #unregistered method.

How do I subclass WASession?

It is sometimes necessary to subclass WASession. Typical situations for subclassing WASession.

Seaside applications are assigned their session class using the "config" application ("Session Class" field). It can also be set programmatically

apppreferenceAt:#sessionClassput:MySession

How do I subclass WAApplication?

It is sometimes necessary to subclass WAApplication, for instance when it is needed to display a session expiration page.

When you subclass WAApplication, make sure that the subclass reimplements #description on the class side, this will ensure that you can differentiate the WAApplication subclasses in the "config" application. Once the WAApplication is in place you can use the "config" application to create your Seaside application.

New Seaside applications can also be created programmatically by carefully reimplementing #applicationWithPath: on the class side of your root component.

How do I get the requester’s IP address?

It is sometimes necessary to know the IP address of the requester. For instance you may want to produce a different behavior when the request comes from "localhost".

The IP address is normally available from the native request object. The native request object is obtained by sending #nativeRequest to the current Seaside request object, like this:

The native request object will be a Kom request, a Swazoo request or a WebToolkit request depending on the exact environment.

For instance, with Squeak:

ipAddress:=nativeRequestremoteAddress.

How do I display an expiration page?

When the user wants to reuse an expired Seaside session, Seaside silently starts a new session. It is sometimes necessary to change this default behavior and notify the user that the session has expired.

First thing to do is to subclass WAApplication. Next thing is to re-implement either #handleExpiredRequest: or #expiryPathFor:.

In #handleExpiredRequest: you are given a chance to build a redirect response to another Seaside application that will display the expiration component.

Below is a very simple example based on reimplementing #expiryPathFor:

expiryPathFor:aRequest^selfbasePath,'?expired=true'

The expired=true field can be obtained by implementing #initialRequest: in the application root component, for instance:

To find out the mime-type aMimeType of a filename you can let Seaside do the guessing:

MIMETypeforFileNameReturnSingleMimeTypeOrDefault:'/tmp/test.pdf'

How do I secure a Seaside application for deployment?

remove all not needed applications

put the remaining applications into deployment mode

remove the config application or choose a good username and password (not the default!)

make sure you’re protected against SQL-injection

How does Seaside protect me against XSS?

Per default all output is escaped for HTML unless especially reqested by using the #html: method.

How do I change the title of a page?

In a visible component implement:

updateRoot:anHtmlRootsuperupdateRoot:anHtmlRoot.anHtmlRoottitle:'the new pageTitle'

How do I use google analytics?

Google analytics is a powerful and free analytic service provided by google. To use it in seaside:

You need to have a google account and to register your site name to google analytics.

You need to configure a bit the registered site in google analytics so as to exclude all dynamic variables of the url (_s, _k and friends). The easiest solution is to simply remove all parameters by creating a custom filter. See the screenshot below [1].

You need to insert a link in your main seaside component (one that is always rendered).

in your main component, add a method, say #renderGAnalyticsOn: that is called from #renderContentOn: