Send both parameters and objects to servlet

K

kikotores

Is it possible to send both parameters ( as if coming from a form) and
binary objects( such as vector) from an applet to a servlet. I want to
be able to read properties as regular parameters using getParameter and
also get objects. Is this possible and if so how do I set up the
regular parameters ( provided I am writing the binary objects to a
stream) and how do I then retrieve them.
 
M

Matt Humphrey

Is it possible to send both parameters ( as if coming from a form) and
binary objects( such as vector) from an applet to a servlet. I want to
be able to read properties as regular parameters using getParameter and
also get objects. Is this possible and if so how do I set up the
regular parameters ( provided I am writing the binary objects to a
stream) and how do I then retrieve them.

getParameter () returns a String so you have to encode your object as a
String--essentially making it a parameter. You can do this by serializing to
byte [] and then encoding with Base64 or serializing to XML (e.g. XStream)
and encoding with URLEncoder (or it's non-deprecated equivalent). String
representations of objects (object graphs) can get very big and there may be
limits on the total sizes of all the parameters in a GET request. You
should be able to send via POST without problem.

When you perform getParameter, just decode and deserialize back to get a
copy of the object.

Matt Humphrey (e-mail address removed) http://www.iviz.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top