greenstone.org greenstone wiki greenstone trac planet greenstone

Changeset 16105

Show
Ignore:
Timestamp:
2008-06-23 12:16:22 (4 months ago)
Author:
ak19
Message:

Changed once more to return formatted string again, and to only trim the string if the first char is whitespace (java code for trim doesn't do the check). Preserves previous change of prepending an <xml> start tag.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • greenstone3/trunk/resources/java/QBRSOAPServer.java.in

    r16103 r16105  
    737737                Element response = mr.process(message);  
    738738                      // won't be null, MR always returns some response 
    739                  
     739 
     740                // Return it as a String formatted for display 
     741                String responseMsg = this.converter.getPrettyString(response);  
     742                                  // this.converter.getString(response); 
     743 
    740744                // In order to avoid "Content is not allowed in prolog" exception on the  
    741745                // web services' client end (problem encountered in GS mailing list), need  
    742746                // to make sure no characters (incl spaces) preceed the  XML sent back  
    743747                // from here. It may also require the <?xml?> tag at the very start. 
    744                 return "<?xml version=\"1.0\" encoding=\"utf-8\"?>" 
    745                     + this.converter.getString(response).trim(); 
    746                 // Return it as a String formatted for display 
    747                 // return this.converter.getPrettyString(response);  
    748  
     748                if(responseMsg.charAt(0) == ' ') { 
     749                    responseMsg = responseMsg.trim(); 
     750                } 
     751                 
     752                return "<?xml version=\"1.0\" encoding=\"utf-8\"?>"+responseMsg; 
    749753        } 
    750754