+ @RequestMapping(value={"/searchDictionary"}, method={RequestMethod.POST})
+ public ModelAndView searchDictionaryController(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ Object resultList = null;
+ String uri = request.getRequestURI();
+ String body = callPAP(request, response, "POST", uri.replaceFirst("/", "").trim());
+ if(body.contains("CouldNotConnectException")){
+ List<String> data = new ArrayList<String>();
+ data.add("Elastic Search Server is down");
+ resultList = data;
+ }else{
+ JSONObject json = new JSONObject(body);
+ resultList = json.get("policyresult");
+ }
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ PrintWriter out = response.getWriter();
+ JSONObject j = new JSONObject("{result: " + resultList + "}");
+ out.write(j.toString());
+ return null;
+ }
+