File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with reading servlet output" Watch "Problem with reading servlet output" New topic

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?
Consider Paul's rocket mass heater.
subject: Problem with reading servlet output
It's not a secret anymore!