Database Reference
In-Depth Information
Anatomy of a URL Rewriting-Based Application
This section will take you through the anatomy of a mini demo application that uses
URL rewriting. Although tiny, it shows you the important components and
characteristics.
The demo application is part of the example code for this topic; if you have installed
that correctly you can start it with this URL (don't forget the terminating slash):
http://localhost:8080/exist/apps/exist-book/building-applications/mini-application/ .
Don't let the URL format annoy you. We'll talk about creating
more user-friendly URLs soon, in “Changing the URL for URL
Rewriting” on page 205 .
You should see something like Figure 9-1 .
Figure 9-1. The home screen of our example mini application
Notice that the URL visible in your browser changed and now ends in /home . It
brings up a page generated by an XQuery script, but strangely enough, the URL
doesn't end in .xq .
Typing your name and pressing Submit brings up a similar “Hello <name> ” screen;
nothing particularly fancy is going on. So what makes this a typical eXist URL rewrit‐
ing application?
A URL rewriting−based application has a central XQuery script as a single point of
entrance for all requests. This is always called controller.xql and located in the root
collection of your application. For Example 9-1 , it is in /db/apps/exist-book/building-
applications/mini-application/controller.xql .
 
Search WWH ::




Custom Search