if (name == null || value == null) {
throw new XProcException(step.getNode(), "Invalid cookie: " + node);
}
SetCookie cookie = new BasicClientCookie(name, value);
if (domain != null) { cookie.setDomain(domain); }
if (path != null) { cookie.setPath(path); }
if (expires != null) {
Date date = null;
try {
if (expires.length() > 21) {
// expires = yyyy-MM-dd'T'HH:mm:ss+00:00"
expires = expires.substring(0,22) + expires.substring(23);
date = iso8601tz.parse(expires);
} else {
// expires = yyyy-MM-dd'T'HH:mm:ss"
date = iso8601.parse(expires);
}
cookie.setExpiryDate(date);
} catch (ParseException pe) {
throw new XProcException(pe);
}
}