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