| | |
| | | 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"; |
| | | |
| | |
| | | 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 |
| | |
| | | |
| | | public void finish(InputStream in, OutputStream out) throws IOException { |
| | | in.close(); |
| | | finish(out); |
| | | } |
| | | |
| | | public void finish(OutputStream out) throws IOException { |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | |
| | | exchange.sendResponseHeaders(code, bytes.length); |
| | | OutputStream os = exchange.getResponseBody(); |
| | | os.write(bytes); |
| | | os.flush(); |
| | | os.close(); |
| | | finish(os); |
| | | } |
| | | |
| | | |