tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Venkatesh Srinivasan <venkatesh.sriniva...@oracle.com>
Subject Re: Application to Servlet communication
Date Wed, 11 Jul 2001 15:12:53 GMT
What is the significance of adding the line ?
>>>InputStream in = servletConnection.getInputStream();
What difference does it makes?

Venky

Gregor Kovaè wrote:

> THANK YOU !!!!!
>
> You are the best!!
>
> At 17:46 11.7.01 +0530, you wrote:
>
> >Please add
> >
> >InputStream in = servletConnection.getInputStream();
> >
> >after you have closed your output stream.
> >
> >It will work.
> >
> >HTH,
> >
> >Shuklix
> >
> >
> >-----Original Message-----
> >From: Fernando_Salazar@lotus.com [mailto:Fernando_Salazar@lotus.com]
> >Sent: Wednesday, July 11, 2001 5:26 PM
> >To: tomcat-user@jakarta.apache.org
> >Subject: Re: Application to Servlet communication
> >
> >
> >
> >A number of folks recently posted similar questions ...
> >I think things work better when you specify
> >"application/x-java-serialized-object" as
> >the content type of the data you are writing.  In the code below, you're
> >using
> >"application/x-www-form-urlencoded", which definitely would not help.
> >
> >- Fernando
> >
> >
> >
> >Hi all!
> >
> >I'm trying to do some application/applet to servlet communication where I
> >want to send an object to servlet.
> >My application code:
> >              URL testServlet = new
> >URL("http://localhost:83/testApp/servlet/TestServlet");
> >              URLConnection servletConnection = testServlet.openConnection
> >();
> >
> >              // inform the connection that we will send output and accept
> >input
> >              servletConnection.setDoInput(true);
> >              servletConnection.setDoOutput(true);
> >
> >              // Don't use a cached version of URL connection.
> >              servletConnection.setUseCaches(false);
> >              servletConnection.setDefaultUseCaches(false);
> >
> >              // Specify the content type that we will send binary data
> >              //servletConnection.setRequestProperty("Content-Type",
> >"application/octet-stream");
> >              servletConnection.setRequestProperty("Content-Type",
> >"application/x-www-form-urlencoded");
> >
> >              // send the student object to the servlet using serialization
> >              ObjectOutputStream outputToServlet = new
> >ObjectOutputStream(servletConnection.getOutputStream());
> >
> >              // serialize the object
> >              outputToServlet.writeObject(new HelloObject(message));
> >
> >              outputToServlet.flush();
> >              outputToServlet.close();
> >
> >results in
> >Http10Interceptor: SocketException reading request, ignored
> >message on tomcat 3.3m4.
> >
> >Any idea what I'm doing wrong ?
> >
> >Any help will be appreciated.
> >
> >Best regards,
> >            Kovi


Mime
View raw message