Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create a servlet that answers for an image?

 
Michael Dekmetzian
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the Servlets forum.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,
I have an example of this on my site.
http://simple.souther.us
Look for SimpleStream.
 
Michael Dekmetzian
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also remeber to set your mime type.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure but try this:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic