I am using Cactus 1.6.1. And here is the code snippet.
public void beginLCUpload(org.apache.cactus.WebRequest theRequest)
{
String
filpath=Bootstrap.getDynamicProperties().getProperty("datafilepath");
HTTPClient.NVPair[] opts = { new HTTPClient.NVPair("fileName",
"contract.txt") };
HTTPClient.NVPair[] file = { new HTTPClient.NVPair("ctrFile",
filpath+File.separatorChar+"contract.txt") };
try {
byte[] data = HTTPClient.Codecs.mpFormDataEncode(opts, file, hdrs);
InputStream i = new ByteArrayInputStream(data);
theRequest.setUserData(i);
theRequest.setContentType(hdrs[0].getValue());
i.close();
//logData("Adding cookies: ");
addCookie(theRequest);
/*
Vector cookie = theRequest.getCookies();
ListIterator itr = cookie.listIterator();
while (itr.hasNext()) {
org.apache.cactus.Cookie
obj = (org.apache.cactus.Cookie)itr.next();
logData("Cookie name: " + obj.getName());
logData("Cookie value: " + obj.getValue());
}
*/
} catch (IOException e) {
System.out.println("Error Building Multipart" + e.toString());
} catch (NFUnitTestException e1) {
System.out.println("Error Building Multipart" + e1.toString());
}
}
public void addCookie(org.apache.cactus.WebRequest theRequest) {
theRequest.addCookie("co1", "user1");
theRequest.addCookie("co2", "pas1");
}
-----Original Message-----
From: Mallinath Suralikal (C) [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 10, 2004 12:50 PM
To: Cactus Users List
Subject: adding Cookie - request object doesn't get updated.
Hi,
I am adding the Cookies using WebRequest.addCookie(String, String). At the
server side, if I do getCookies(), it's returning null. Looks like the
cookies are not updated on the request.
Thanks
Malli