// transform the Cactus cookies into HttpClient cookies
org.apache.commons.httpclient.Cookie[] httpclientCookies =
new org.apache.commons.httpclient.Cookie[cookies.size()];
for (int i = 0; i < cookies.size(); i++) {
Cookie cactusCookie = (Cookie) cookies.elementAt(i);
// If no domain has been specified, use a default one
String domain;
if (cactusCookie.getDomain() == null) {
domain = Cookie.getCookieDomain(theRequest,
theUrl.getHost());
} else {
domain = cactusCookie.getDomain();
}
// If not path has been specified , use a default one
String path;
if (cactusCookie.getPath() == null) {
path = Cookie.getCookiePath(theRequest, theUrl.getFile());
} else {
path = cactusCookie.getPath();
}
httpclientCookies[i] =
new org.apache.commons.httpclient.Cookie(
domain, cactusCookie.getName(),
cactusCookie.getValue());
httpclientCookies[i].setComment(cactusCookie.getComment());
httpclientCookies[i].setExpiryDate(
cactusCookie.getExpiryDate());
httpclientCookies[i].setPath(path);
httpclientCookies[i].setSecure(cactusCookie.isSecure());
}
// and create the cookie header to send
Header cookieHeader =
org.apache.commons.httpclient.Cookie.createCookieHeader(