I have a requirement wherein, i need to have a Web client (say c) from which i can view reports from my two individual applications (say A and B). All i will doing is to request for data from "A" and "B" via ajax and display the response in "C".
I have almost completed, but when the response from A or B contains image (which have been generated using cewolf taglib) then, i would save the image locally and display them (since path are relative).
I have no problem in saving the images, but when displaying them, i get a sometimes StreamCorruptedException. Below is the stack trace for the same,
Following is the code i am using to save the image,
URL url = new URL("http://<hostname>:<port>/<application name>/<image name>");
DataInputStream dIn = new DataInputStream(url.openStream());
DataOutputStream dOut = new DataOutputStream( new FileOutputStream( new File("<file name>")));
byte toRead = new byte;
while( dIn.read( toRead ) != -1 )
//flush & close the streams.
Please let me know why I am getting this exception and how to overcome this.
Thanks in advance,
At what point is that exception thrown? If I understand it correctly, you're saving the image to disk, and the exception is thrown in some Java code you've written that later displays it? How does it do that, and what role does cewolf play in that?
Log in to post a comment.