mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix bug
This commit is contained in:
parent
9b01a23a60
commit
7116177225
@ -2,7 +2,7 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.7.21 (2022-02-07)
|
# 5.7.21 (2022-02-10)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【extra 】 增加jetbrick模板支持
|
* 【extra 】 增加jetbrick模板支持
|
||||||
@ -24,6 +24,7 @@
|
|||||||
* 【extra 】 修复EmojiUtil.toHtmlHex()方法(pr#519@Gitee)
|
* 【extra 】 修复EmojiUtil.toHtmlHex()方法(pr#519@Gitee)
|
||||||
* 【system 】 修复CpuInfo.getUsed()方法(issue#2116@Github)
|
* 【system 】 修复CpuInfo.getUsed()方法(issue#2116@Github)
|
||||||
* 【dfa 】 修复密集匹配和贪婪匹配冲突问题(issue#2126@Github)
|
* 【dfa 】 修复密集匹配和贪婪匹配冲突问题(issue#2126@Github)
|
||||||
|
* 【http 】 修复Action中HttpExchange没有关闭问题
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.7.20 (2022-01-20)
|
# 5.7.20 (2022-01-20)
|
||||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.CharsetUtil;
|
|||||||
import com.sun.net.httpserver.HttpContext;
|
import com.sun.net.httpserver.HttpContext;
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
|
|
||||||
|
import java.io.Closeable;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,7 +13,7 @@ import java.nio.charset.Charset;
|
|||||||
* @author looly
|
* @author looly
|
||||||
* @since 5.2.6
|
* @since 5.2.6
|
||||||
*/
|
*/
|
||||||
public class HttpServerBase {
|
public class HttpServerBase implements Closeable {
|
||||||
|
|
||||||
final static Charset DEFAULT_CHARSET = CharsetUtil.CHARSET_UTF_8;
|
final static Charset DEFAULT_CHARSET = CharsetUtil.CHARSET_UTF_8;
|
||||||
|
|
||||||
@ -45,4 +46,12 @@ public class HttpServerBase {
|
|||||||
public HttpContext getHttpContext() {
|
public HttpContext getHttpContext() {
|
||||||
return getHttpExchange().getHttpContext();
|
return getHttpExchange().getHttpContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用{@link HttpExchange#close()},关闭请求流和响应流
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
this.httpExchange.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,5 +33,6 @@ public class ActionHandler implements HttpHandler {
|
|||||||
new HttpServerRequest(httpExchange),
|
new HttpServerRequest(httpExchange),
|
||||||
new HttpServerResponse(httpExchange)
|
new HttpServerResponse(httpExchange)
|
||||||
);
|
);
|
||||||
|
httpExchange.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user