|
@@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
|
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
|
+import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
|
import org.apache.http.entity.StringEntity;
|
|
@@ -140,11 +141,11 @@ public class BochaServiceImpl implements BochaService {
|
|
|
context.append("{");
|
|
|
for (BochaResult item : bochaResultList) {
|
|
|
context.append("\"" + index + "\":{"+
|
|
|
- "\"name\":\"" + item.getName() + "\"," +
|
|
|
- "\"summary\":\"" + item.getSummary() + "\"," +
|
|
|
- "\"site_icon\":\"" + item.getSiteIcon() + "\"," +
|
|
|
- "\"site_name\":\"" + item.getSiteName() + "\"," +
|
|
|
- "\"url\":\"" + item.getUrl() + "\"" +
|
|
|
+ "\"name\":\"" + item.getName().replace("\"", "\\\"") + "\"," +
|
|
|
+ "\"summary\":\"" + item.getSummary().replace("\"", "\\\"") + "\"," +
|
|
|
+ "\"site_icon\":\"" + item.getSiteIcon().replace("\"", "\\\"") + "\"," +
|
|
|
+ "\"site_name\":\"" + item.getSiteName().replace("\"", "\\\"") + "\"," +
|
|
|
+ "\"url\":\"" + item.getUrl().replace("\"", "\\\"") + "\"" +
|
|
|
"}" +
|
|
|
((index == bochaResultList.size()) ? "": ",")
|
|
|
);
|