SWC's Tomcat

Intro

We have an instance of Apache Tomcat running on sw.deri.org. If you have any questions about Tomcat, either Sebastian, Knud, or Andreas might be able to give you some sort of support.

URIs that depend on the underlying technology used are ugly. See Cool URIs don't change for further info.

Therefore, we have a) year/month/projectname for projects and b) mappings for persistent things related to sw.deri.org such as wiki and search. The mapping to "nice" URIs is done using Apache2 and mod_jk2. In the long run, we will deactivate Tomcat listening on port 8180 and only serve web applications via Apache2 on the standard HTTP port 80.

Installing Web Applications

The following is incomplete and incorrect due to my limited knowledge about Tomcat.

  1. upload your *.war file
  2. put it into /var/lib/tomcat/webapps/ directory
  3. wait until somebody restarts tomcat and the new web application is picked up

In the example, I uploaded search.war and copied that to /var/lib/tomcat/webapps/search.war. The web application is then accessible at http://sw.deri.org:8180/search/ (after something happend so that tomcat recognizes that there was a change to the *.war).

@@@ problem here: tomcat unpacks the war file (sometimes?), and doesn't really recognize when the war file has changed. I presume that because the program in question uses a Listener, which has startup and shutdown functionality.

Mappings

What I want to do is map the search web application (specifically just one URI, http://sw.deri.org:8180/search/search) to http://sw.deri.org/search. It doesn't work. What I can do with the following workers2.properties is to access the servlet via http://sw.deri.org/search/search.

[uri:/search/*]
group=ajp13:localhost:8009
    

However, I want to have it at http://sw.deri.org/search.

If I change [uri:/search/*] to [uri:/bla/*] I have also to change the name of the web application in /var/lib/tomcat/webapps to bla, otherwise the mapping doesn't work correctly.

Rewrites

We can use mod_rewrite to map URIs. ^ means start of the line, $ means end. If you just map search$, every URI ending with search (ie. 2004/12/deriserch/) would be redirected, which is not what we want.

RewriteEngine on
RewriteRule ^/search$ /suche/suchen [PT]
RewriteRule ^/2004/06/yars/store$ /yars/yars [PT]
RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 9
    

Still a problem is that we want to disable the original URI, so that requests can only be accessed via the mapped URI.


$Id: index.html 655 2004-12-09 17:09:34Z aharth $