File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Blocking access to a file extension Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Blocking access to a file extension" Watch "Blocking access to a file extension" New topic

Blocking access to a file extension

Fernando Vissentini

Joined: Oct 06, 2003
Posts: 11
Hi, is there anyway to block the access to a file that has a specific extension in the tomcat configuration? for instance: I wanna block files with extensions EXE to be accessed.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

Then why have them under your web app root in the first place?

You might get better responses if you informed us what the exe files are used for.

[Asking smart questions] [About Bear] [Books by Bear]
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
I suppose you could map the extension to a servlet that said "not allowed"
Look at the way *.jsp is mapped to the JspServlet in the default web.xml for an example.
I agree. Here's the link:
subject: Blocking access to a file extension
It's not a secret anymore!