Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP - tunneling and Objects..

 
Ilja Smoli
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello...
I've done Http tunneling between servlet and applet. Servlet sends objects to applet using ObjectOutputStream writeObject() method. Question is:
I have a class lets say MyObject.
Than i create an instance of this like:

To get it in applet i have to cast this object to something like

So i have to have a copy of MyObject class located with applet on client side? Im I right?
And second question: is it possible to send few objects at once?
Thx in advance...
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ilja
Yes you can send multiple objects in the stream following either of the following ways,
1. Create vector, arraylist , collection of the objects and send them at first shot
2. write multiple object by calling write() serveral times to the outputstream
In either case you have to remember how you are sending the objects and recieve them appropriately.
ALso, make sure your objects are Serializable (or Externalizable)..
Regards
Maulin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic