- Timestamp:
- 2013-03-13T14:11:28+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
r26507 r27073 36 36 import org.greenstone.gsdl3.util.UserContext; 37 37 import org.greenstone.gsdl3.util.XMLConverter; 38 import org.json.JSONObject; 38 39 import org.w3c.dom.Document; 39 40 import org.w3c.dom.Element; 40 41 import org.w3c.dom.Node; 41 42 import org.w3c.dom.NodeList; 42 43 import org.json.JSONObject;44 import org.json.XML;45 43 46 44 import com.google.gson.Gson; … … 691 689 } 692 690 693 if (output.equals("json")) { 694 response.setContentType("application/json"); 691 if (output.equals("json")) 692 { 693 response.setContentType("application/json"); 695 694 } 696 695 else if (!output.equals("html") && !output.equals("server") && !output.equals("xsltclient")) … … 756 755 String xml_string = this.converter.getPrettyString(xml_result); 757 756 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); 757 if (output.equals("json")) 758 { 759 try 760 { 761 JSONObject json_obj = org.json.XML.toJSONObject(xml_string); 762 763 out.println(json_obj.toString()); 764 } 765 catch (Exception e) 766 { 767 e.printStackTrace(); 768 out.println("Error: failed to convert output XML to JSON format"); 769 } 770 } 771 else 772 { 773 out.println(xml_string); 771 774 } 772 775
Note:
See TracChangeset
for help on using the changeset viewer.