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

architectural help required

 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to develop an application who will serve as image sharing sort of tool. What i want is to upload all images of users in WEB-INF directory for security purpose, so that the images are not listed by users from URL. But on the same time, i want to display these images on a user specific page. How can i do this?

Second thing, I want to add a filter on images, so that I may track anyone (a website) which request of this image (request for image means user has uploaded image on my site and had given the image link on other site). So if an image is hosted in WEB-INF how can i add filter to it?

I want to do all this but i don't want to use any spring/struts/jsf thing. All i want to use is either Servlet or JSP.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would start by writing a servlet that can stream an image from under WEB-INF to a browser. Because this will give you a central point of control for all image retrievals, there will probably b no need for the filter.

You can grant/deny access and log any traffic right from there.
I have an an example app on my site with a servlet that streams images from under WEB-INF.
http://simple.souther.us
Look for SimpleStream.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:
I would start by writing a servlet that can stream an image from under WEB-INF to a browser. Because this will give you a central point of control for all image retrievals, there will probably b no need for the filter.

You can grant/deny access and log any traffic right from there.
I have an an example app on my site with a servlet that streams images from under WEB-INF.
http://simple.souther.us
Look for SimpleStream.


Forgot....
That same project is also available for download from our CodeBarn
http://www.javaranch.com/codebarn
 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thanks. i'll look around for servlet stream. But i want to get the information (ip address etc)of the person who access that image, using my web applicatio url or given the link of that image on some other site
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a look at the methods on the request, you can find the client IP address. The http-referrer header (search google) should contain the url of the page where the image was loaded.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic