@SuppressWarnings("PMD.AvoidCatchingThrowable") private void handle( ServletRequestHandler pReqHandler, HttpServletRequest pReq, HttpServletResponse pResp) throws IOException { JSONAware json = null; int code = 200; try { // Check access policy requestHandler.checkClientIPAccess(pReq.getRemoteHost(), pReq.getRemoteAddr()); // Dispatch for the proper HTTP request method json = pReqHandler.handleRequest(pReq, pResp); code = requestHandler.extractResultCode(json); if (backendManager.isDebug()) { backendManager.info("Response: " + json); } } catch (Throwable exp) { JSONObject error = requestHandler.handleThrowable(exp); code = (Integer) error.get("status"); json = error; } finally { sendResponse(pResp, code, json.toJSONString()); } }
@Override public void destroy() { backendManager.unregisterOwnMBeans(); super.destroy(); }