Christopher Hull wrote:
> I'm trying to get a servlet to fire off for a given file type. This
> doesn't seem to work, but the setup looks pretty straightforward.
>
> In my web.xml I set up a servlet.
>
> <servlet>
> <servlet-class>com.foo.aServlet</class>
> <servlet-name>handleFile</name>
> </serv.et>
>
> <servlet-mapping>
> <servlet-name>handleFile</s-name>
> <url-pattern>*.txt</url-pattern>
> <servlet-mapping>
>
> When I ask for the servlet directlly by name it comes up, yet when I ask
> for a .txt file (which exists) the servlet isn't found.
>
> Does this feature currently work in Tomcat?
>
Yes, the feature works -- that is how JSP pages get mapped to the JSP servlet,
for example.
One thing to note, though. If you are using Tomcat behind a web server,
instead of stand-alone, you will need to add an additional configuration
command for the web server so that it knows about this mapping also. For
Apache, for example, you'd need to add:
AddHandler jserv-servlet .txt
to make Apache aware of your desires.
>
> Thanks;
> -Chris
Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html