aspose file tools*
The moose likes Servlets and the fly likes How to create a servlet that answers for an image? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to create a servlet that answers for an image? " Watch "How to create a servlet that answers for an image? " New topic
Author

How to create a servlet that answers for an image?

Michael Dekmetzian
Greenhorn

Joined: Nov 25, 2004
Posts: 10
Hi,

I tried to search for this, so my apologies if its all been done before.

I need to create a servlet that will answer for an image reference, so that :

<img src= "http://someurl/myapp/setsomething.gif"> will trigger the servlet to run. Someone has told me in the past but unfortunately i've forgotten

Can anyone help (or post a link to where this has been discussed before)?

It would be much appreciated
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

Moved to the Servlets forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Michael,
I have an example of this on my site.
http://simple.souther.us
Look for SimpleStream.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Michael Dekmetzian
Greenhorn

Joined: Nov 25, 2004
Posts: 10
Neither of those was quite what i wanted. I did work it out though.

Here is how i did it :



A Heap of code has been snipped, but I was able to get the details out of the request with String path = request.getPathInfo();

The PIXEL_GIF is created by



Pretty basic when it came down to it really..
ak pillai
author
Ranch Hand

Joined: Feb 11, 2006
Posts: 288
Also remeber to set your mime type.


java j2ee job interview questions with answers | Learn the core concepts and the key areas
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
I am not sure but try this:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create a servlet that answers for an image?