aspose file tools*
The moose likes JSP and the fly likes Accessing a zip file through a JSP page. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Accessing a zip file through a JSP page." Watch "Accessing a zip file through a JSP page." New topic
Author

Accessing a zip file through a JSP page.

Rudy Rusli
Ranch Hand

Joined: Jun 01, 2006
Posts: 114
I have a zip file in my JSP application for clients to access (password-protected by tomcat).

I also have a JSP that will detect the last time user tries to access, how many times they have accessed, etc. before it redirects user to the zip file. But this is the ideal case.
There's no way to prevent user from accessing the zip file directly.

How do I make sure that the clients only will be able to access the zip file through the JSP page?

Thanks in advance for all the help.
Rudy Rusli
Ranch Hand

Joined: Jun 01, 2006
Posts: 114
As an additional notes, I have Apache in front of Tomcat.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

JSP is an astoundingly poor technology choice for this.

What I would do is to place the zip file somewhere in the WEB-INF folder hierarchy. This will protect it from direct access.

Then I'd write a servlet that will serve up that zip file, setting appropriate headers, when it has been determined that the request is properly authenticated.

JSP is not very good at serving non-text files.
[ February 28, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rudy Rusli
Ranch Hand

Joined: Jun 01, 2006
Posts: 114
> JSP is an astoundingly poor technology choice for this.
Why is this?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

JSP assumes that it is serving text. Trying to use it to serve anything else is fraught with pitfalls.

More in this article if interested.
 
 
subject: Accessing a zip file through a JSP page.