Database Reference
In-Depth Information
• Finally, other users have read permissions to view the eXist logo in the
images/
existdb.png
file. This makes it viewable by everyone.
For more restricted applications, you could limit these execute and other permissions
to certain database users and/or groups. It's easy to provide the user with a login page
that changes its database identity, allowing you to fine-tune access. See
“Application
Security” on page 212
for more about this.
Our last comment on this example involves inspecting the request and passing
parameters. When you have a look at the code of the
hello.xq
file, you can see that it
calls the eXist extension function
request:get-parameter
to read the name of the
person invoking the request:
<p>
Hello
<i>
{
request:get-parameter
(
'personname'
,
'?'
)}
</i></p>
The
request
extension module can get you a lot more information; see
“The request
Extension Module” on page 209
.
How eXist Finds the Controller
To test a URL controller, you can use the URL
http://localhost:8080/exist/apps/<path‐
toyourapp>
, as in the beginning of the previous section. We'll do a sneak preview
here of information to come (in
“The controller-config.xml Configuration File” on
page 206
) to make sure you understand how this works and how eXist finds the
controller:
eXist has a configuration file called
$EXIST_HOME/webapp/WEB-INF/controller-
config.xml.
In it are entries like this:
<root
pattern=
"/apps"
path=
"xmldb:exist:///db/apps"
/>
When you request a page that starts with
http://localhost:8080/exist/apps/
, the follow‐
ing happens:
• Jetty recognizes the eXist prefix
/exist
and passes control to the eXist main
servlet.
• This servlet sees a URL starting with
/apps
. It tries to match this with an entry in
controller-config.xml
.
• If a match is found, the value of its
path
attribute is used to try to locate a con‐
troller. So, in this case, eXist will first look for a controller in
xmldb:exist:///db/
apps/controller.xql.
• If no match is found, it uses the rest of the URL to try to find the controller. It
starts at the most specific path and works backward until it finds a controller.
Search WWH ::
Custom Search