@RequestMapping( value = VIEW_API_REQUEST, method = {RequestMethod.POST, RequestMethod.GET}) public void listAllSupportedActions( HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "url", required = false) String url) throws IOException { if (url == null) { StringBuilder sb = new StringBuilder(); sb.append("<html><body>"); for (String key : SERVICE_SUPPORT_MAP.keySet()) { RequestResponse rr = SERVICE_SUPPORT_MAP.get(key); sb.append("<div>url : ").append(key).append("</div>"); sb.append("<div style=\"padding-left:15px>\">") .append(rr.getRequest().getDescriptorForType().getFullName()) .append(" : ") .append(rr.getResponse().getDescriptorForType().getFullName()) .append("</div>"); } sb.append("</body></hhtml>"); response.getOutputStream().write(sb.toString().getBytes()); return; } apiRequested(response, true, url); return; }
private boolean apiRequested(HttpServletResponse response, boolean api, String request) throws IOException { if (api) { RequestResponse rr = SERVICE_SUPPORT_MAP.get(request); if (rr != null) { StringBuffer sb = new StringBuffer(); sb.append(rr.getRequest().getDescriptorForType().getFullName()) .append(" : ") .append(rr.getResponse().getDescriptorForType().getFullName()); response.getOutputStream().write(sb.toString().getBytes()); } else { response.getOutputStream().write("No matching service for url".getBytes()); } return true; } return false; }