mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix bug
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.util.CharsetUtil;
|
||||
import com.sun.net.httpserver.HttpContext;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
@@ -12,7 +13,7 @@ import java.nio.charset.Charset;
|
||||
* @author looly
|
||||
* @since 5.2.6
|
||||
*/
|
||||
public class HttpServerBase {
|
||||
public class HttpServerBase implements Closeable {
|
||||
|
||||
final static Charset DEFAULT_CHARSET = CharsetUtil.CHARSET_UTF_8;
|
||||
|
||||
@@ -45,4 +46,12 @@ public class HttpServerBase {
|
||||
public HttpContext 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 HttpServerResponse(httpExchange)
|
||||
);
|
||||
httpExchange.close();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user