You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hussayn Dabbous <da...@saxess.com> on 2001/04/19 22:08:54 UTC

how can i get apache to redirect a whole subdir to a servlet ?

Hy, there;

i need to tunnel a whole subdirectory of my server through a servlet,
that does some internal access rights checking.

Is it possible to configure tomcat/apache in a way, that all requests 
within a specific subdir are forwarded to a servlet ?


I already tried it by creating a ...webapps/zone/WEB_INF/web.xml by using the 
following servlet-mapping within the tomcat-config:

----------------------
<web-app>

  <servlet>
    <servlet-name>zone-checker</servlet-name>
    <servlet-class>com.saxess.ZoneChecker</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>zone-checker</servlet-name>
    <url-pattern>/zone/safe-area/*</url-pattern>
  </servlet-mapping>

</web-app>
---------------------

I checkecd, that the Servlet can be accessed by issuing this url:

   http://localhost/zone/servlet/zone-checker

This is the expected behaviour. But the servlet is NOT invoked, 
when i try e.g.:

   http://localhost/zone/safe-area/index.html

which i expected also to be served from the servlet due to the servlet-mapping
rule above. Instead the index.html file is simply displayed in the broswer.
Maybe tomcat does not know about the servlet-mapping ?


For the server-config, i used following :

-----------------------------------------
...
Alias /zone "/mnt2/local/install/apache/jakarta/build/tomcat/webapps/zone"
<Directory "/mnt2/local/install/apache/jakarta/build/tomcat/webapps/zone">
    Options Indexes FollowSymLinks
</Directory>
ApJServMount /zone/servlet /zone
<Location "/zone/WEB-INF/">
    AllowOverride None
    deny from all
</Location>
<Location "/zone/META-INF/">
    AllowOverride None
    deny from all
</Location>

<LocationMatch /zone/*.jsp>
  SetHandler jserv-servlet
</LocationMatch>

<LocationMatch /zone/safe/*>
  SetHandler jserv-servlet
</LocationMatch>
...
-----------------------------------------

Again i tried out lots of combinations, but none brought the desired results.
Even, if i redirect all requests from apache to tomcat as follows:

ApJServMount /zone ajpv12://localhost:8007/zone

Nothing happens (except the index.html is simply displayed)

Maybe i completely missunderstand something here ? Anyone can help me ?
That would be great. 

Thanks, Hussayn
-- 
Dr. Hussayn Dabbous
SAXESS Software Design GmbH
Neuenhöfer Allee 125
50935 Köln
Telefon: +49-221-56011-0
Fax:     +49-221-56011-20
E-Mail:  dabbous@saxess.com