mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add test
This commit is contained in:
@@ -12,6 +12,7 @@ import java.io.IOException;
|
||||
* @author Looly
|
||||
* @since 5.2.6
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface Action {
|
||||
|
||||
/**
|
||||
|
@@ -0,0 +1,13 @@
|
||||
package cn.hutool.http.server;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
|
||||
public class BlankServerTest {
|
||||
public static void main(String[] args) {
|
||||
HttpUtil.createServer(8888)
|
||||
.addAction("/", (req, res)->{
|
||||
res.write("Hello Hutool Server");
|
||||
})
|
||||
.start();
|
||||
}
|
||||
}
|
@@ -9,7 +9,6 @@ public class DocServerTest {
|
||||
HttpUtil.createServer(80)
|
||||
// 设置默认根目录,
|
||||
.setRoot("D:\\workspace\\site\\hutool-site")
|
||||
// 返回JSON数据测试
|
||||
.start();
|
||||
|
||||
DesktopUtil.browse("http://localhost/");
|
||||
|
@@ -23,11 +23,11 @@ public class SimpleServerTest {
|
||||
// 文件上传测试
|
||||
// http://localhost:8888/formTest?a=1&a=2&b=3
|
||||
.addAction("/file", (request, response) -> {
|
||||
final UploadFile file = request.getMultipart().getFile("file");
|
||||
// 传入目录,默认读取HTTP头中的文件名然后创建文件
|
||||
file.write("d:/test/");
|
||||
Console.log("Write file to: d:/test/");
|
||||
response.write(request.getParams().toString(), ContentType.TEXT_PLAIN.toString());
|
||||
final UploadFile file = request.getMultipart().getFile("file");
|
||||
// 传入目录,默认读取HTTP头中的文件名然后创建文件
|
||||
file.write("d:/test/");
|
||||
Console.log("Write file to: d:/test/");
|
||||
response.write(request.getParams().toString(), ContentType.TEXT_PLAIN.toString());
|
||||
}
|
||||
)
|
||||
.start();
|
||||
|
Reference in New Issue
Block a user