From 9d3717abd59e1672f5d8d7888ce613afdc7fb3c5 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Wed, 24 Jan 2024 13:00:11 +0000
Subject: [PATCH] HttpResponder.finish aufgeteilt

---
 src/de/uhilger/httpserver/base/HttpResponder.java |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/de/uhilger/httpserver/base/HttpResponder.java b/src/de/uhilger/httpserver/base/HttpResponder.java
index 69cc132..88ad962 100644
--- a/src/de/uhilger/httpserver/base/HttpResponder.java
+++ b/src/de/uhilger/httpserver/base/HttpResponder.java
@@ -42,15 +42,10 @@
   public static final String CONTENT_TYPE = "Content-Type";
   public static final String LAST_MODIFIED_DATE_HEADER = "Last-Modified";
 
-  //public static final String RANGE_HEADER = "Range";
-  //public static final String CONTENT_RANGE_HEADER = "Content-Range";
-
   /* Statuscodes */
   public static final int SC_OK = 200;
   public static final int SC_NOT_FOUND = 404;
   
-  //public static final int SC_PARTIAL_CONTENT = 206;
-
   /* HTTP Methoden */
   public static final String HTTP_GET = "GET";
   
@@ -58,13 +53,6 @@
   public static final String STR_BYTES = "bytes";
   public static final String STR_NOT_FOUND = " not found.";
   public static final String LM_PATTERN = "EEE, dd MMM yyyy HH:mm:ss zzz";
-  
-  //public static final String STR_BLANK = " ";
-  //public static final String STR_DASH = "-";
-  //public static final String STR_COMMA = ",";
-  //public static final String STR_DOT = ".";
-  //public static final String RANGE_PATTERN = "[^\\d-,]";
-  //public static final String WELCOME_FILE = "index.html";
   
   /**
    * Den Inhalt einer Datei ausliefern
@@ -101,6 +89,10 @@
   
   public void finish(InputStream in, OutputStream out) throws IOException {
     in.close();
+    finish(out);
+  }
+
+  public void finish(OutputStream out) throws IOException {
     out.flush();
     out.close();
   }
@@ -144,8 +136,7 @@
     exchange.sendResponseHeaders(code, bytes.length);
     OutputStream os = exchange.getResponseBody();
     os.write(bytes);
-    os.flush();
-    os.close();
+    finish(os);
   }
 
 

--
Gitblit v1.9.3