comparison src/goodjava/webserver/handlers/DirHandler.java @ 1607:fa066aaa068c

nginx caching
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 30 Apr 2021 20:23:28 -0600
parents 55d7b60c074d
children d88fb2eb15aa
comparison
equal deleted inserted replaced
1606:7c7f28c724e8 1607:fa066aaa068c
40 File file = fileHandler.file(request); 40 File file = fileHandler.file(request);
41 String path = request.path; 41 String path = request.path;
42 if( path.endsWith("/") && file.isDirectory() ) { 42 if( path.endsWith("/") && file.isDirectory() ) {
43 DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss zzz"); 43 DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss zzz");
44 Response response = new Response(); 44 Response response = new Response();
45 response.headers.put( "content-type", "text/html; charset=utf-8" ); 45 response.headers.put( "Content-Type", "text/html; charset=utf-8" );
46 Writer writer = new OutputStreamWriter( new ResponseOutputStream(response) ); 46 Writer writer = new OutputStreamWriter( new ResponseOutputStream(response) );
47 writer.write( "<!doctype html>\n<html>\n" ); 47 writer.write( "<!doctype html>\n<html>\n" );
48 writer.write( "\t<head>\n" ); 48 writer.write( "\t<head>\n" );
49 writer.write( "\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n" ); 49 writer.write( "\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n" );
50 writer.write( "\t\t<style>\n" ); 50 writer.write( "\t\t<style>\n" );