File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Protect files from being downloaded via URLRewriteFilter / login filter? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Protect files from being downloaded via URLRewriteFilter / login filter?" Watch "Protect files from being downloaded via URLRewriteFilter / login filter?" New topic
Author

Protect files from being downloaded via URLRewriteFilter / login filter?

Michael Cropper
Ranch Hand

Joined: Sep 30, 2009
Posts: 137
Is there a way to protect files from being downloaded?

I have set up a login system so only people with a valid username/password can view the pages, but when I put the full URL of a particular file into the browser when logged out I can still download the file.

Since Google is extremely good at getting its hands on material that it shouldn't, I don't want this to be possible.

The login filter I have set up is for anything within the directory "/secure/" - which is where I have put the documents, although they are still accessible directly.

Has anyone had any experience of this?

Thanks
Michael
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I had to fix my servlet filter so that it DID allow users who weren't logged in to download images and CSS and things like that. So it shouldn't be difficult to write a filter which doesn't allow users who aren't logged in to download files.
Michael Cropper
Ranch Hand

Joined: Sep 30, 2009
Posts: 137
Looks like I was being a little impatient :-) The filter I have in place actually already does what I need. Must have been Chrome lagging a little when I was testing this

Michael
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Alrighty then! I quite often forget to do the right set of things to refresh my test server after I make changes, too.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Protect files from being downloaded via URLRewriteFilter / login filter?
 
Similar Threads
Getting correct filename with JFileChooser
FTP File Attributes on Finance Gateway servers
author, subclipse
Browser Authentication
setting up java