")
105 | .append("" + todo.getId() + " | ")
106 | .append("" + todo.getTitle() + " | ")
107 | .append("" + todo.getDescription() + " | ")
108 | .append("" + todo.getUserId() + " | ")
109 | .append("" + todo.isDone() + " | ")
110 | .append("" + todo.getPriority() + " | ")
111 | .append("" + todo.getCreatedAt() + " | ")
112 | .append("
").toString();
113 | }).toList();
114 | String tableBody = String.join("", rows);
115 | responseData = todo_list_html.formatted(tableBody);
116 |
117 |
118 | } else {
119 | Long id = getPathVariable(uri);
120 | Todo todo = todoService.getById(id);
121 |
122 | }
123 | httpExchange.getResponseHeaders().add(CONTENT_TYPE_KEY, CONTENT_TYPE_VALUE);
124 | httpExchange.sendResponseHeaders(200, 0);
125 | os.write(responseData.getBytes());
126 | os.close();
127 | }
128 |
129 | private void processUnhandledRequest(HttpExchange httpExchange) throws IOException {
130 | OutputStream os = httpExchange.getResponseBody();
131 | httpExchange.sendResponseHeaders(404, 0);
132 | httpExchange.getResponseHeaders().add(CONTENT_TYPE_KEY, CONTENT_TYPE_VALUE);
133 | BaseResponse