[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-user
Subject:    Re: Check if a file exists before passing to a servlet in TC7
From:       Jordan Michaels <jordan () viviotech ! net>
Date:       2012-07-27 14:16:53
Message-ID: e3b16cc6-6666-4e74-a53e-db459dd13a04 () mail3
[Download RAW message or body]

Thank you very much Konstantin! That worked perfectly. =)

Warm regards,
Jordan Michaels



----- Original Message -----
From: "Konstantin Kolinko" <knst.kolinko@gmail.com>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, July 27, 2012 2:24:02 AM
Subject: Re: Check if a file exists before passing to a servlet in TC7

2012/7/27 Jordan Michaels <jordan@viviotech.net>:
> I'm trying to have Tomcat serve up a directory listing if a file listed in
> the <welcome-file-list> doesn't exist. I have custom files there that will
> get passed to my servlet if the normal HTML or JSP files don't exist.
>
> In Tomcat 6, this seemed to work nicely. I have my files listed in the
> welcome file list and if they didn't exist, I'd get a directory listing like
> I wanted. But, in Tomcat 7, as soon as Tomcat sees that I have a custom file
> in my <welcome-file-list>, it simply hands off the request to my servlet and
> I get a 404 from my servlet instead of a directory listing from Tomcat's
> "default" servlet.
>
> Is it possible to have Tomcat 7 check for the existence of a file before it
> passes a request to my servlet? That way I could get the directory listing
> from the default servlet?
>
> I'm just using the built-in Coyote Web server on both TC6 and TC7, so no
> external web server should be complicating things.
>
> Any direction on this would be greatly appreciated.
>

See "resourceOnlyServlets" attribute on <Context>. I think it will help here.
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic