Changeset 32366
- Timestamp:
- 2018-08-23T13:37:52+12:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/Receptionist.java
r30586 r32366 17 17 import org.w3c.dom.Node; 18 18 import org.w3c.dom.NodeList; 19 import org.w3c.dom.NamedNodeMap; 19 20 20 21 /** … … 273 274 274 275 // the request is part of the page 275 page.appendChild( GSXML.duplicateWithNewName(doc, request, GSXML.PAGE_REQUEST_ELEM, true));276 page.appendChild(duplicateRequest(doc, request)); 276 277 // add the response too 277 278 Element page_response = GSXML.duplicateWithNewName(doc, (Element) GSXML.getChildByTagName(action_response, GSXML.RESPONSE_ELEM), GSXML.PAGE_RESPONSE_ELEM, true); … … 293 294 } 294 295 296 // This is pretty much a straight copy of the Element, with a new top root node name, but also, removing any NOSAVE parameters. 297 protected Element duplicateRequest(Document owner, Element request) { 298 299 Element duplicate; 300 duplicate = owner.createElement(GSXML.PAGE_REQUEST_ELEM); 301 // Copy element attributes 302 NamedNodeMap attributes = request.getAttributes(); 303 for (int i = 0; i < attributes.getLength(); i++) 304 { 305 Node attribute = attributes.item(i); 306 duplicate.setAttribute(attribute.getNodeName(), attribute.getNodeValue()); 307 } 308 // Copy element children 309 NodeList children = request.getChildNodes(); 310 for (int i = 0; i < children.getLength(); i++) 311 { 312 Node child = children.item(i); 313 if (child.getNodeName().equals(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER)) { 314 Element param_list = (Element)owner.importNode(child, true); 315 NodeList params = param_list.getElementsByTagName(GSXML.PARAM_ELEM); 316 for (int j=params.getLength()-1; j>=0; j--) { 317 Element p = (Element)params.item(j); 318 if (!p.getAttribute(GSXML.SENSITIVE_ATT).equals("")) { 319 logger.error("removing param "+p.getAttribute("name")); 320 param_list.removeChild(p); 321 } 322 } 323 duplicate.appendChild(param_list); 324 } else { 325 duplicate.appendChild(owner.importNode(child, true)); 326 } 327 } 328 329 330 return duplicate; 331 332 333 334 335 } 295 336 protected boolean setUpBaseInterface(String base_interface) 296 337 {
Note:
See TracChangeset
for help on using the changeset viewer.