Hi all, I want to invoke a servlet through java code.But issue is how to get the gif files used in the servlets?Becouse when we invoke a servlet through java code instead of browser,we get only bytes or strings from the inputstream of the servlet.
you can call a servlet from your code using a HttpURLConnection I do this often and have the servlet send me a custom object that contains the data I want since I know what's coming back I read it with an ObjectInputStream then cast it to what it is I guess the same approach would work with a gif perhaps somebody else has an easier way
Once you have the image, it's just a stream of bytes, just like the text of the HTML page. You can store it to a file or display it or whatever else you need to do with it.
There are libraries that help you interpret a stream of HTML, like TagSoup, JHTMLTidy and NekoXMI.