Basisklassen zum Modul jdk.httpserver
ulrich
2021-06-14 5e0e7a52a4b00fc81e14956b3943f78faca2fa9b
Vereinfachung am Responder
1 files modified
8 ■■■■ changed files
src/de/uhilger/httpserver/base/HttpResponder.java 8 ●●●● patch | view | raw | blame | history
src/de/uhilger/httpserver/base/HttpResponder.java
@@ -130,13 +130,7 @@
   * @throws IOException falls etwas schief geht entsteht dieser Fehler
   */
  public void sendNotFound(HttpExchange e, String fname) throws IOException {
    OutputStream os = e.getResponseBody();
    String response = fname + STR_NOT_FOUND;
    byte[] bytes = response.getBytes(StandardCharsets.UTF_8);
    e.sendResponseHeaders(SC_NOT_FOUND, bytes.length);
    os.write(bytes);
    os.flush();
    os.close();
    antwortSenden(e, SC_NOT_FOUND, fname + STR_NOT_FOUND);
  }  
  public void antwortSenden(HttpExchange exchange, int code, String antwort) throws IOException {