Shai Zarzewski
Shai Zarzewski

Reputation: 1698

send object using HTTPservletResponse

I have a client-server program that are using servlets to communicate with each other, each of them is sending an object (of a class that I defined) to the other. Can I send it directly using the setContentType(myClass) in the servlet? Or do I need to something completely different? I couldn't find a way to do it.

Upvotes: 1

Views: 1230

Answers (2)

Anthony
Anthony

Reputation: 12746

There is one more alternative approach: use WebServices. You can get to know more about them at Apache AXIS website.

Upvotes: 0

Anthony
Anthony

Reputation: 12746

You need to serialize the object at server side, send it as an array of bytes, or encoded as a text (using base64 for example), and than deserialize it at the client side.

Upvotes: 2

Related Questions