Ignore:
Timestamp:
2014-04-10T14:39:33+12:00 (10 years ago)
Author:
kjdon
Message:

Lots of changes. Mainly to do with removing this.doc from everywhere. Document is not thread safe. Now we tend to create a new Document everytime we are starting a new page/message etc. in service this.desc_doc is available as teh document to create service info stuff. But it should only be used for this and not for other messages. newDOM is now static for XMLConverter. method param changes for some GSXML methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/DefaultReceptionist.java

    r24993 r28966  
    2929    {
    3030        super.addExtraInfo(page);
    31 
     31        // the document for the page
     32        Document doc = page.getOwnerDocument();
     33        // a new document to create messages to send to MR
     34        Document msg_doc = XMLConverter.newDOM();
    3235        Element page_request = (Element) GSXML.getChildByTagName(page, GSXML.PAGE_REQUEST_ELEM);
    3336        // if it is a system request, then we don't bother with this.
     
    7073        if (this.language_list != null)
    7174        {
    72             page_response.appendChild(this.language_list);
     75          page_response.appendChild(doc.importNode(this.language_list, true));
    7376        }
    7477        Element coll_description = (Element) GSXML.getChildByTagName(page_response, GSXML.COLLECTION_ELEM);
     
    8083        if (coll_description == null)
    8184        {
    82 
     85          logger.debug("getting the coll description");
    8386            // we dont have one yet - get it
    84             Element coll_about_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
    85             Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, userContext);
     87
     88            Element coll_about_message = msg_doc.createElement(GSXML.MESSAGE_ELEM);
     89            Element coll_about_request = GSXML.createBasicRequest(msg_doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, userContext);
    8690            coll_about_message.appendChild(coll_about_request);
    8791
     
    104108            }
    105109            // have found one, append it to the page response
    106             coll_description = (Element) this.doc.importNode(coll_description, true);
     110            coll_description = (Element) doc.importNode(coll_description, true);
    107111            page_response.appendChild(coll_description);
    108112            get_service_description = true;
    109113        }
     114       
    110115
    111116        // have got a coll description
     
    151156
    152157        // we will send all the requests in a single message
    153         Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
     158        Element info_message = msg_doc.createElement(GSXML.MESSAGE_ELEM);
    154159        for (int i = 0; i < services.getLength(); i++)
    155160        {
     
    157162            String name = c.getAttribute(GSXML.NAME_ATT);
    158163            String address = GSPath.appendLink(coll_name, name);
    159             Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, address, userContext);
     164            Element info_request = GSXML.createBasicRequest(msg_doc, GSXML.REQUEST_TYPE_DESCRIBE, address, userContext);
    160165            //Element req_param_list = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
    161166            //req_param_list.appendChild(GSXML.createParameter(this.doc, GSXML.SUBSET_PARAM, GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER));
Note: See TracChangeset for help on using the changeset viewer.