• Post Reply Bookmark Topic Watch Topic
  • New Topic

Proper way to Stream a Image URL in Java Servlet?  RSS feed

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am trying to load this Image
http://live.surveyshack.com/Portals/16480/images/25-iStock_000004333554Medium.jpg

into my servlet and write that on my response of servlet but I am getting FileNotFoundException

this is what I have try so far


I suspect I can't stream or load URL from remote location like this so what is right way to load an Image from Externally Hosted Files.

I also want to view other resources like audios,videos,textfiles and others to

How do I acheive this?

Thanks
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have solved my problem by this code


I would like to know is it right way to access Image file Stored online to a servlet?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66152
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the image is already available via a URL, why are you bothering to relay it through a servlet? Why doesn't the client just use the original URL? Streaming an image through a servlet is usually done when the file is not otherwise already available via URL.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Bear

My mistake thanks for pointing it out
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!