6.3.4Registering the Counter Component
Now we should register the component as an application so that we can access it directly from the url path that will be associated with it. To register a component as an application, we ask the administration interface class WAAdmin
to do the work for us:
WAAdmin register: WebCounter asApplicationAt: 'webcounter'
will register the component WebCounter
as the application named webcounter
.
Note that this expression can also be added in the WebCounter
class method initialize
which is invoked when the class is loaded into memory:
WebCounter class>>initialize
WAAdmin register: self asApplicationAt: 'webcounter'
Now you can launch the application in your web browser by going to http://localhost:8080/webcounter, see Figure 51.