tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wyn Easton <wyn_eas...@yahoo.com>
Subject Re: applet-servlet communication
Date Tue, 30 Jan 2001 17:32:31 GMT

Try adding:

     uc.setRequestMethod("POST");
     
Before you get the output stream.



Also, a word of caution.  I have found that if the response from 
the web server takes longer that the keep-alive timeout value set
for your web sever, your applet will not be notified (no exception
thrown).  I client will hang on the read "forever".  I've tried
looping on the available() method of InputStream but it always
returns 0 (zero) bytes and never throws an exception, even if the
web server has closed the connection.

Maybe some one has a suggestion that could help both of us???



--- Carlos R Armas <armas@lucent.com> wrote:
> 
> I am using something like the following (applet):
> 
> 	URL url = new URL("http://localhost:8080/...");
> 	URLConnection uc = url.openConnection();
> 	uc.setDoOutput(true);
> 	uc.setDoInput(true);
> 	uc.setUseCaches(false);
> 	uc.setRequestProperty(...);
> 	DataOutputStream out = new DataOutputStream(uc.getOutputStream());
> 	out.writeBytes(...);
> 	out.flush();
> 	out.close();
> 
> 	then I use InputStreamReader to read whatever the servlet sent back.
> 
> My assumption was that this is the mechanism to send POST data from
> the
> applet. Maybe here is my mistake.
> 
> I haven't tried calling doPost from the doGet method.....
> 
> 
> 
> 
> Wyn Easton wrote:
> > 
> > Carlos - I'm curious, how are you sending the data from the applet
> > to the servlet?  Why do you think the applet is setup to use the
> "POST"
> > method?
> > 
> > You could always call your doPost() method in your servlet from
> > the doGet() method.
> > 
> > --- Carlos R Armas <armas@lucent.com> wrote:
> > >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org
> 


=====
Wyn Easton
wyn_easton@yahoo.com

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Mime
View raw message