Mercurial Hosting > luan
comparison src/goodjava/webserver/examples/Example.java @ 1607:fa066aaa068c
nginx caching
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 30 Apr 2021 20:23:28 -0600 |
parents | 219f2b937f2b |
children |
comparison
equal
deleted
inserted
replaced
1606:7c7f28c724e8 | 1607:fa066aaa068c |
---|---|
21 | 21 |
22 public class Example implements Handler { | 22 public class Example implements Handler { |
23 | 23 |
24 public Response handle(Request request) { | 24 public Response handle(Request request) { |
25 Response response = new Response(); | 25 Response response = new Response(); |
26 response.headers.put( "content-type", "text/plain; charset=utf-8" ); | 26 response.headers.put( "Content-Type", "text/plain; charset=utf-8" ); |
27 try { | 27 try { |
28 Writer writer = new OutputStreamWriter( new ResponseOutputStream(response) ); | 28 Writer writer = new OutputStreamWriter( new ResponseOutputStream(response) ); |
29 writer.write("Hello World\n"); | 29 writer.write("Hello World\n"); |
30 writer.close(); | 30 writer.close(); |
31 } catch(IOException e) { | 31 } catch(IOException e) { |