Restart.
Tapestry provides a service called restart, which discards the session and takes you to the application's
Home page. Its URL will be something like http://localhost:8080/jumpstart-max/app?service=restart.
The ServiceLink component knows how to generate the right URL. When you use it like this: <a jwcid="@ServiceLink" service="restart" href="">click here to restart</a>
the resulting link is like this: click here to restart.
This service is so handy during the code-test-code-test cycle that it is worth bookmarking the link.
Log out.
The recommended way to log a user out of a Tapestry application is to send them through the restart service, eg. <a jwcid="@ServiceLink" service="restart" href="">Log Out</a>
But what if you need the application to do additional work, such as logging, before restarting?
Then instead of ServiceLink you'll have to use DirectLink like this: <a jwcid="@DirectLink" listener="listener:doLogout" href="">Log Out</a>
and write a doLogout() method that does the additional work, then gets a link to the restart engine service, and
redirects to it. To see a working example look at the doLogout() method of Border.java
(web/src/main/java/jumpstart/max/web/components/Border.java)
What's a service?
Well, in Tapestry every time you press a Submit button or click on a link, be it a PageLink, a DirectLink, or whatever,
you are actually sending a request to a Tapestry engine service which will do the work.
There is a table of examples below.
Do I really need to know? It is not essential to know this stuff to develop with Tapestry,
but it just might help you debug a problem one day.
Write your own service! What's really cute is that if you find something's missing from Tapestry,
you can create a new engine service and invoke it from a possibly new component, just as the creator of
A Hello Service has done.