You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jay Chalfant <jc...@outbackinc.com> on 2000/08/23 23:09:21 UTC

alternative struts-example config

Hello,

I am playing with the various configuration files when running
struts-example on Tomcat 3.1 & Apache in order to understand the
behavior of each (httpd.conf, tomcat-apache.conf, server.xml, web.xml, &

action.xml). I have the struts-example running but I would like to make
it run in a config in which apache redirects URI's by extension, not
path. So far I cannot make this work. My present approach is described
below.

My httpd.conf includes a handwritten (not the auto-generated)
tomcat-apache.conf which provides handlers for *.jsp and *.do:

AddHandler jserv-servlet .jsp
AddHandler jserv-servlet .do            # - for struts example app

I also provide a context path in the same file:

Alias /struts-example /galaxy/tomcat/webapps/struts-example
<Directory "/galaxy/tomcat/webapps/struts-example">
    Options Indexes FollowSymLinks
</Directory>
# ApJServMount /struts-example /struts-example
<Location /struts-example/WEB-INF/ >
    AllowOverride None
    deny from all
</Location>

As you can see, I am omitting the servlet mount point because I want to
make extension mapping work (I don't want Tomcat to serve the entire app

tree.)

My server.xml does not provide any context path settings. I am relying
on Tomcat to auto-gen these from the webapps dir when it starts.

Finally, I am running the default web.xml and action.xml that come with
struts example. The former provides for the *.do extension mapping to
the action servlet:

  <!-- Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

All said and done, this does not work. The *.jsp files run through
Tomcat, but the *.do URI's fail:

Error: 400

Location: /struts-example/editRegistration.do

Invalid path was requested

This error appears to be created by Tomcat, not Apache.

If I uncomment the ApJServMount command, the struts-example will work.
However, from the reading I've done, I should be able to direct URI's to

the action servlet by extension, rather than path. Again, I don't want
Tomcat to serve the entire tree. Note: I did try the 'default' mapping:

ApJServMount /struts-example/servlet /struts-example

but the example app is not set up for this type of path redirection.

If anyone can spot an error in config or logic listed above I would
really appreciate it.

thanks,

-J