Source:
public HttpServiceResponse handle(HttpServiceRequest request) throws Exception { HttpServiceResponse response = new HttpServiceResponse(); ClientConfiguration adminConf = new ClientConfiguration(conf); BookKeeperAdmin admin = new BookKeeperAdmin(adminConf); if (HttpServer.Method.PUT == request.getMethod() || HttpServer.Method.POST == request.getMethod()) { String requestBody = request.getBody(); if (requestBody == null) { admin.close(); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Null request body for lostBookieRecoveryDelay."); return response; } @SuppressWarnings("unchecked") HashMap<String, Integer> configMap = JsonUtil.fromJson(requestBody, HashMap.class); if (configMap != null && configMap.containsKey("delay_seconds")) { int delaySeconds = configMap.get("delay_seconds"); admin.setLostBookieRecoveryDelay(delaySeconds); admin.close(); response.setCode(HttpServer.StatusCode.OK); response.setBody("Success set lostBookieRecoveryDelay to " + delaySeconds); return response; } else { admin.close(); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Request body not contains lostBookieRecoveryDelay."); return response; } } else if (HttpServer.Method.GET == request.getMethod()) { try { int delaySeconds = admin.getLostBookieRecoveryDelay(); admin.close(); response.setCode(HttpServer.StatusCode.OK); response.setBody("lostBookieRecoveryDelay value: " + delaySeconds); LOG.debug("response body:" + response.getBody()); return response; } catch (Exception e) { e.printStackTrace(); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Exception when get lostBookieRecoveryDelay." + e.getMessage()); return response; } } else { admin.close(); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Not found method. Should be PUT/POST method"); return response; } }

Target:
public HttpServiceResponse handle(HttpServiceRequest request) throws Exception { HttpServiceResponse response = new HttpServiceResponse(); if (HttpServer.Method.PUT == request.getMethod()) { String requestBody = request.getBody(); if (requestBody == null) { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Null request body for lostBookieRecoveryDelay."); return response; } @SuppressWarnings("unchecked") HashMap<String, Integer> configMap = JsonUtil.fromJson(requestBody, HashMap.class); if (configMap != null && configMap.containsKey("delay_seconds")) { int delaySeconds = configMap.get("delay_seconds"); bka.setLostBookieRecoveryDelay(delaySeconds); response.setCode(HttpServer.StatusCode.OK); response.setBody("Success set lostBookieRecoveryDelay to " + delaySeconds); return response; } else { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Request body not contains lostBookieRecoveryDelay."); return response; } } else if (HttpServer.Method.GET == request.getMethod()) { try { int delaySeconds = bka.getLostBookieRecoveryDelay(); response.setCode(HttpServer.StatusCode.OK); response.setBody("lostBookieRecoveryDelay value: " + delaySeconds); LOG.debug("response body:" + response.getBody()); return response; } catch (Exception e) { LOG.error("Exception occurred while getting lost bookie recovery delay", e); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Exception when get lostBookieRecoveryDelay." + e.getMessage()); return response; } } else { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Not found method. Should be PUT method"); return response; } }