public void addEndpoint(String path, Endpoint ep) { on(path, (request, response) -> { response.getHeaders().put("connection", "close"); Binder result; try { Result epResult = new Result(); // System.out.println("extracted params: " + extractParams(request)); ep.execute(extractParams(request), epResult); result = Binder.of( "result", "ok", "response", epResult); } catch (Exception e) { result = Binder.of( "result", "error", "error", e.toString(), "errorClass", e.getClass().getName() ); } response.setBody(Boss.pack(result)); }); }