- Timestamp:
- 2012-11-23T00:34:55+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
r26210 r26507 41 41 import org.w3c.dom.NodeList; 42 42 43 import org.json.JSONObject; 44 import org.json.XML; 45 43 46 import com.google.gson.Gson; 44 47 import com.google.gson.reflect.TypeToken; … … 688 691 } 689 692 690 if (!output.equals("html") && !output.equals("server") && !output.equals("xsltclient")) 693 if (output.equals("json")) { 694 response.setContentType("application/json"); 695 } 696 else if (!output.equals("html") && !output.equals("server") && !output.equals("xsltclient")) 691 697 { 692 698 response.setContentType("text/xml"); // for now use text … … 747 753 Node xml_result = this.recept.process(xml_message); 748 754 encodeURLs(xml_result, response); 749 out.println(this.converter.getPrettyString(xml_result)); 755 756 String xml_string = this.converter.getPrettyString(xml_result); 757 758 if (output.equals("json")) { 759 try { 760 JSONObject json_obj = org.json.XML.toJSONObject(xml_string); 761 762 out.println(json_obj.toString()); 763 } 764 catch (Exception e) { 765 e.printStackTrace(); 766 out.println("Error: failed to convert output XML to JSON format"); 767 } 768 } 769 else { 770 out.println(xml_string); 771 } 750 772 751 773 displaySize(session_ids_table);
Note:
See TracChangeset
for help on using the changeset viewer.