Element cookiesElement = doc.createElementNS(null, "cookies");
root.appendChild(cookiesElement);
Cookie[] cookies = this.request.getCookies();
if (cookies != null) {
Cookie current;
Element node;
Element parent;
for(int i = 0; i < cookies.length; i++) {
current = cookies[i];
parent = doc.createElementNS(null, "cookie");
parent.setAttributeNS(null, "name", current.getName());
cookiesElement.appendChild(parent);
node = doc.createElementNS(null, "comment");
node.appendChild(this.createTextNode(doc, current.getComment()));
parent.appendChild(node);
node = doc.createElementNS(null, "domain");
node.appendChild(this.createTextNode(doc, current.getDomain()));
parent.appendChild(node);
node = doc.createElementNS(null, "maxAge");
node.appendChild(this.createTextNode(doc, ""+current.getMaxAge()));
parent.appendChild(node);
node = doc.createElementNS(null, "name");
node.appendChild(this.createTextNode(doc, current.getName()));
parent.appendChild(node);
node = doc.createElementNS(null, "path");
node.appendChild(this.createTextNode(doc, current.getPath()));
parent.appendChild(node);
node = doc.createElementNS(null, "secure");
node.appendChild(doc.createTextNode(current.getSecure() ? "true" : "false"));
parent.appendChild(node);
node = doc.createElementNS(null, "value");
node.appendChild(this.createTextNode(doc, current.getValue()));
parent.appendChild(node);
node = doc.createElementNS(null, "version");
node.appendChild(this.createTextNode(doc, ""+current.getVersion()));
parent.appendChild(node);
}
}
}