• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

problem writing ImageServlet?

 
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if some body have time then only read my question as i am explaining my problem in detail.

i have a 2 websites named

a) http://www.site1.com
b) http://www.site2.com

in my site1 i have some jsp pages, and jsp have <img> tag.

<img src="images/myimage1.jpg">
<img src="images/myimage2.gif">

but site1 dont have folder images but it is at site2

i dont want to change my <img> tags to
<img src="http://www.site2.com/images/myimage1.jpg">
or to something else because i don't want to show any one that the images are coming from some other website.


so i have a created servlet named ImageServlet and its configuration in web.xml is like this :


i have mapped ImageServlet to jpg and gif files because i dont want to change <img> tags which more than 100 times in jsp pages in site1

so every request to jpg or gif files goes to ImageServlet

if the browser request for the image
http://www.site1.com/images/myimage1.jpg

servlet takes the request.getServletPath() in this case it is : /images/myimage1.jpg
and make url connection to site2 in this case : http://www.site2.com/images/myimage1.jpg

the servlet opens InputStream read the content of the image and send it back to the client.

now the problem starts here

whenever i type the url in the browser
http://www.site1.com/images/myimage1.jpg

my servlets doGet() is called for infinite time and the browser does not get any response

the code of my servlet :-


in my server console i can only see lines printed till urlcon
please help what is the problem or mistake here.
 
Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic