We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 572c843 commit a6c055bCopy full SHA for a6c055b
2 files changed
src/cn/aofeng/demo/httpclient/README.md
@@ -0,0 +1,8 @@
1
+#HTTP
2
+##HTTP客户端
3
+###代码
4
+[使用Fluent API发起HTTP请求](cn/aofeng/demo/httpclient/FluentApi.java)
5
+
6
+##HTTP服务端
7
8
+[使用JDK中的API建立简单的HTTP Server](src/cn/aofeng/demo/httpclient/SimpleHttpServer.java)
src/cn/aofeng/demo/httpclient/SimpleHttpServer.java
@@ -62,6 +62,8 @@ public void handle(HttpExchange httpEx) throws IOException {
62
// 返回响应
63
String rc = "冒号后面是收到的请求,原样返回:"+content;
64
byte[] temp = rc.getBytes(_charset);
65
+ Headers outHeaders = httpEx.getResponseHeaders();
66
+ outHeaders.set("ABC", "123");
67
httpEx.sendResponseHeaders(200, temp.length);
68
OutputStream outs = httpEx.getResponseBody();
69
outs.write(temp);
0 commit comments