| Author |
Custamize serialization and deserialization when using IIOP
|
Raghu Medipalli
Greenhorn
Joined: May 17, 2005
Posts: 2
|
|
I am trying to initilize some static fields on the client side with values present in an object returned from the server side. The exact scenario is that on client side I call an EJB (present on server side). The EJB returns an object of a specific class type to the client. This object is, I guess, serialized when sent over wire. I am implementing the readObject() and writeObject() methods in the class whose object is serialized and sent over wire to do my custom serialization as follows. The protocol we are using is IIOP. I implemented the following methods on my client side. private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { System.out.println("Inside readObject()"); s.defaultReadObject(); MyValuableClass.myStaticAttribute = "newVersion"; } private void writeObject(java.io.ObjectOutputStream stream) throws IOException, ClassNotFoundException { System.out.println("Inside writeObject()"); s.defaultWriteObject(); } The problem here is that the readObject() and writeObject() methods are not been called during serialization and deserialization process. The System.outs are not printed at all. I came accross somewhere on the net that if you are using IIOP then it has its own way of serializing and deserializing objects. Kindly let me know how I handle custome serialization and deserialization if I am using IIOP. The goal I am trying to accomplish here is that whenever the object returned by EJB call is reconstructed (deserialized) on the client side, I want to do the default serialization plus some static variables' initialization of one of my class with the values pesent in the object returned by EJB. Any help is highly appreciated. Thanks, Raghu
|
 |
 |
|
|
subject: Custamize serialization and deserialization when using IIOP
|
|
|