Sending compressed objects from applet to servlet.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, March 4, 2002 04:16 AM

Hi all, I am sending serialized objects from applet to servlet and viceversa. I am using the code that is at the end. I want compress the object before send it. I have found several articles about using the ZipInputStream and ZipOutputStream classes to write objects to a file or read them from a file. Please, can you say me if I must use the ZipInputStream/ZipOutputStream classes or it is better to use GZipInputStream/GZipOutputStream ?. How can I use this classes to send compressed objects betewn applet and servlet ?. Thank You. /************************************/ /* SENDING AN OBJECT FROM AN APPLET */ /*******************   More>>

Hi all,

I am sending serialized objects from applet to servlet and viceversa. I am using the code that is at the end.
I want compress the object before send it. I have found several articles about using the ZipInputStream and ZipOutputStream classes to write objects to a file or read them from a file.

Please, can you say me if I must use the ZipInputStream/ZipOutputStream classes or it is better to use GZipInputStream/GZipOutputStream ?.

How can I use this classes to send compressed objects betewn applet and servlet ?.

Thank You.





/************************************/

/* SENDING AN OBJECT FROM AN APPLET */

/************************************/


URL url=new URL(servletUrl);

URLConnection con=url.openConnection();

con.setDoInput(true);

con.setDoOutput(true);

con.setRequestProperty("Content-Type","java-internal/java.lang.Object");



...



// This is the object to send to the servlet.

MiObjAtS objAS = new MiObjAtS();



...



// We send the object to the servlet.

ObjectOutputStream oos = new ObjectOutputStream(con.getOutputStream());

oos.writeObject(objAS);

oos.flush();

oos.close();







/****************************************/

/* RECEIVING AN OBJECT INSIDE A SERVLET */

/****************************************/

ObjectInputStream ooi = new ObjectInputStream(req.getInputStream());

Object obj = null;

MiObjAtS objAS = null;



// We retrieve the object from the applet.

obj=ooi.readObject();

objAS = (MiObjAtS)obj;

ooi.close();



...

   <<Less

Re: Sending compressed objects from applet to servlet.

Posted By:   Shahram_Zadeh  
Posted On:   Thursday, May 2, 2002 01:13 PM

I can do the same thing with IE it works perfect but
my client insists to use NetScape 4.7 it does not even call
the doPost(req, res) of the servlet. Tomcat log shows nothing, java console in browser as well.

anyway it kills me please help!!!!!

I appreciate it in advance
About | Sitemap | Contact