+ } catch (Throwable aEx) {
+ logger.error("Failed to process request.", aEx);
+ sendResponse(200,
+ JsonRpcResponse.forError(new JsonRpcResponse.Error(JsonRpcResponse.Error.INTERNAL_ERROR,
+ "An internal server error has occurred.",
+ null), null),
+ httpExchange);
+ }
+ }
+
+ private void handleEventsEndpoint(HttpExchange httpExchange) throws IOException {
+ if (!"/api/v1/events".equals(httpExchange.getRequestURI().getPath())) {
+ sendResponse(404, null, httpExchange);
+ return;
+ }
+ if (!"GET".equals(httpExchange.getRequestMethod())) {
+ sendResponse(405, null, httpExchange);
+ return;
+ }
+
+ try {
+ final var queryString = httpExchange.getRequestURI().getQuery();
+ final var query = queryString == null ? Map.<String, String>of() : Util.getQueryMap(queryString);
+
+ List<Manager> managers = getManagerFromQuery(query);
+ if (managers == null) {
+ sendResponse(400, null, httpExchange);
+ return;
+ }