What's an engine service?
In Tapestry every time you press a Submit button or click on a link - be it a PageLink, a DirectLink, or whatever -
the URL that it generates will select a Tapestry engine service which will do the work.
A table of Tapestry's engine services is shown below.
Restart.
One such engine service is restart. Its job is to discard your session and take you to the home page
(the home page is specified in the .application file).
The ServiceLink component knows how to invoke restart. Here's an example of how to use it in a template: <a jwcid="@ServiceLink" service="restart" href="">click here to restart</a>
which produces a link like this: click here to restart
which generates a URL like this: http://localhost:8080/jumpstart-max/app?service=restart.
You can see the URL by hovering over the link or by right-clicking on this page and choosing to view the page source.
The restart service is so handy during the 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 there's additional work to do before restarting, such as logging? In that case you would 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/java/jumpstart/min/web/components/Border.java)
Do I really need to know? It is not necessary to know the internals of the engine services, but it's
good to be aware that they exist.
Write your own service! What's really cute is that if you find something is missing from Tapestry,
you can create a new engine service and a component to invoke it, just as the creator of
A Hello Service has done.