Dynamic Web Development with Seaside

3.6.6Registering the Application

To be able to access the application at a URL path, we must register it with Seaside.

First, we must declare that our application component can be a root component, or a starting point. To do this, click the Class tab in the System Browser, add a protocol called testing, and define this class method:

WebCounter class>>canBeRoot 
^ true

Note that the method canBeRoot does not register the application (we will do that in a minute). It only declares that the component should appear in the list of registered applications.

To complete the registration, use the configuration tool in the web browser. If you have closed the browser, reopen it by selecting Seaside | Open Browser on Server in the VisualWorks launcher.

Click the config link in the browser (second item) to open the Configuration tool

Click the Add button to open the editor. Enter a name, NewCounter, for the handler, and select Application as the type, see Figure 24.

Add our application

Click OK to accept this addition.

In the new page, scroll down to the General section. From the Root Class drop-down list, select our application, WebCounter.WebCounter, see Figure 25.

Configuring the application

There are a lot of configuration options available on this page, but we don’t need to bother with them for this example. Scroll down the page a little more and click Save.

Our application is now listed as 'NewCounter', and will be listed on the opening web page. (Open a new browser on the server from the VisualWorks Launcher to verify that.)

This procedure is equivalent to what we do using the expression WebCounter registerAsApplication: 'newcounter' or redefining the class initialize as follows.

WebCounter class>>initialize
self registerAsApplication: 'NewCounter'

To see that it works, go back to http://localhost:7777 and click NewCounter to see the current state of our application.

Registered Component

Pretty boring at the moment.

Copyright © 16 April 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.