viswanathan wrote:

> hi,
>
> I am using URLConnection for communication between my servlet and
applet.
> and here is my code at the applet side
> URLConnection con = myURL.openConnection();
> con.setDoOutputStream(true);
> ObjectOuputStream objout = new
ObjectOutputStream(con.getOutputStream());
> objout.writeObject(myObject);
> objout.flush();
> objout.close();
>
> InputStream is = con.getInputStream();
> while(is.read() != -1) ; is.close();
>
> [...]
>
>
===========================================================================

> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html

Hi,

IMHO the code is not complete:
URLConnection con = myURL.openConnection();
// new code begin
con.setUseCaches(false);    // we want no caching
con.setRequestProperty("CONTENT_TYPE","application/octet-stream");
    // we want to write binary data
con.setDoOutput(true);    // yes, we want to send some data
// new code end
con.setDoOutputStream(true);
ObjectOuputStream objout = new
ObjectOutputStream(con.getOutputStream());
objout.writeObject(myObject);
objout.flush();
objout.close();

Besides, the object you want to send, called myObject, must implement
the interface
java.io.Serializable

These modifications should do the job. In a project, we used a similar
approach
without any problems according to the different kinds of browsers.
By the way, this technique has already a name, it's called
Http-Tunneling.
Hope that helps,
Thorsten
begin:vcard
n:Weber;Thorsten P.
tel;fax:(49)-721-98160129
tel;home:(49)-721-375238
tel;work:(49)-721-98160112
x-mozilla-html:TRUE
url:http://www.computec.com
org:Computec Software GmbH
adr:;;Karlstra�e 52-54;Karlsruhe;;D-76133;Germany
version:2.1
email;internet:[EMAIL PROTECTED]
title:Consultant
fn:Thorsten P. Weber
end:vcard

Reply via email to