Skip to content

Commit

Permalink
Support Unicode characters in reconciliation API (#476)
Browse files Browse the repository at this point in the history
* use PrintWriter in JSONReconcile servlet

* removed not used import
  • Loading branch information
litvinovg authored Nov 7, 2024
1 parent 69d4cde commit 5c01178
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package edu.cornell.mannlib.vitro.webapp.controller.grefine;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand All @@ -11,7 +12,6 @@
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -70,6 +70,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
super.doGet(req, resp);
resp.setContentType("application/json");
resp.setCharacterEncoding("UTF-8");
VitroRequest vreq = new VitroRequest(req);

try {
Expand All @@ -81,7 +82,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
.toString() : vreq.getParameter("callback") + "("
+ qJson.toString() + ")";
// System.out.println("JSONReconcileServlet result: " + responseStr);
ServletOutputStream out = resp.getOutputStream();
PrintWriter out = resp.getWriter();
out.print(responseStr);
} else { // metadata
String defaultNamespace = null;
Expand All @@ -97,7 +98,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
ObjectNode metaJson = getMetadata(req, resp, defaultNamespace, defaultTypeList, serverName, serverPort);
String callbackStr = (vreq.getParameter("callback") == null) ? ""
: vreq.getParameter("callback");
ServletOutputStream out = resp.getOutputStream();
PrintWriter out = resp.getWriter();
out.print(callbackStr + "(" + metaJson.toString() + ")");
}
} catch (Exception ex) {
Expand Down

0 comments on commit 5c01178

Please sign in to comment.