I hope somebody could explain me this weird problem... I have a servlet who
must send requests to another servlet.  I choose to do this with an
URLConnection object.  I create an OutputStream and write my parameters and
values into it.  After that, I create an InputStream to read the return
page (I didn't really need to read the page but it seems necessary to get
done the redirection that is performed at the end of the second request
call).  This was working with servletrunner of jsdk2.0 but it doesn't work
with JRun and resin that I actually use.  It throw a FileNotFoundException
on the second servlet URL when getting the inputstream!?

I seriously think to do this with RequestDispatcher, but I'll be very happy
to be enlighten on this since I don't understand why a file exception for a
url??  Below is the code I use to make the communication between the 2
servlets...

Thanks,
Stephane Cloutier


URLConnection url = servlet.openConnection();
url.setDoOutput(true);
PrintWriter out = new PrintWriter(url.getOutputStream());
out.print("parameter1=value1");
out.print("parameter2=value2");
out.print("parameterX=valueX");
out.close();

InputStream istream = null;
try
{
        istream = url.getInputStream();
}
catch(Exception e)
{
        e.printStackTrace();
}
InputStreamReader ireader = new InputStreamReader(istream);
BufferedReader in = new BufferedReader(new
InputStreamReader(url.getInputStream()));

String inputLine;
while ((inputLine = in.readLine()) != null) System.out.println(inputLine);
in.close();

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to