can i write an Object back as an http response.

can i write an Object back as an http response. my device will send an object to the servlet and in response i need to send an object. is this possible... can i write a sample program to simulate the device.
[221 byte] By [xemaa] at [2007-11-27 1:09:13]
# 1

Yes, though your object must be Serializable.

public void doGet(HttpServletRequest req, HttpServletResponse res)

throws ServletException, IOException {

// code here for real work: Assume obj is the object you want to send back

try {

ObjectOutputStream oos =

new ObjectOutputStream(res.getOutputStream());

oos.writeObject(obj);

oos.close();

} catch (IOException exc) {

exc.printStackTrace();

}

}

edswinga at 2007-7-11 23:44:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...