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 architectural help required Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "architectural help required" Watch "architectural help required" New topic
Author

architectural help required

Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 225
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.


The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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

Joined: May 11, 2006
Posts: 225
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

Joined: Mar 06, 2001
Posts: 13459

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: architectural help required
 
Similar Threads
Hiding URL from source
URL's to images
How to know img tag src attribute loaded completely by action
Display images/ in WEB-INF
Where to store image files in Java web app