Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing a zip file through a JSP page.

 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As an additional notes, I have Apache in front of Tomcat.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64826
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> JSP is an astoundingly poor technology choice for this.
Why is this?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64826
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic