File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Problem with reading servlet output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with reading servlet output" Watch "Problem with reading servlet output" New topic
Author

Problem with reading servlet output

Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
I wanted to read response (raw data for the .jpg image) from the imageServlet into another servlet (mainServlet).
But, when I try to do it, like in the following piece of code:

...
URL url = new URL(protocol + context_path + "/imageServlet?param1=value1¶m2=value2¶m3=value3");
BufferedInputStream buf_is = new BufferedInputStream(url.openStream());
...

I get an error in the first line. It is a server error - code 500, saying "server is confused".
Note: The URL is correct. I have tested it with the jsp form and in that case it works OK.

Why this doesn't work?
What should I do?
Neeraj Dheer
Ranch Hand

Joined: Mar 30, 2005
Posts: 225
can you post the entire exception please?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with reading servlet output
 
Similar Threads
about servlet-mapping
how to use getLastModified() ?
how to encode the query string data using jstl?
Jasper reports generating html files
problem writing ImageServlet?