I have two related questions:
- I'm able to send byte[] over the network for this class:
class Employee implements Serializable{ byte[] avroBytes, //avro data in byte[] array String name }
In my test case, using MockMvc, I'm able to de-serialize it, and then cast it to Employee object because my test case can use the same POJO from code. However the client will not have this POJO or class information. After it receives the bytes, how can it reconstruct this POJO(or whatever is the equivalent in other languages) or Object? Do I need to send in some class information in the header? It's possible that the client is using Python or some other language, so I need a way for this class information to be generic.
In my test case this works:
Employee res = (Employee ) SerializationUtils.deserialize(result.getResponse().getContentAsByteArray());
How will client cast the de-serialized bytes to Employee if they don't have this POJO/information? I could do it in my test case because my code has the Employee class in code.
Additional information to comments:
I serialized it using org.springframework.util.SerializationUtils serialize() method