代码拉取完成,页面将自动刷新
/*
* Copyright (C) [2024] smartboot [zhengjunweimail@163.com]
*
* 企业用户未经smartboot组织特别许可,需遵循AGPL-3.0开源协议合理合法使用本项目。
*
* Enterprise users are required to use this project reasonably
* and legally in accordance with the AGPL-3.0 open source agreement
* without special permission from the smartboot organization.
*/
package tech.smartboot.feat.demo.benchmark;
import tech.smartboot.feat.cloud.FeatCloud;
import tech.smartboot.feat.cloud.annotation.Controller;
import tech.smartboot.feat.cloud.annotation.RequestMapping;
import tech.smartboot.feat.core.common.HeaderValue;
import tech.smartboot.feat.core.server.HttpResponse;
/**
* @author 三刀 zhengjunweimail@163.com
* @version v1.0.0
*/
@Controller
public class FeatApp {
@RequestMapping("/hello")
public String plaintext(HttpResponse response) {
response.setContentType(HeaderValue.ContentType.TEXT_PLAIN_UTF8);
return "Hello World!";
}
@RequestMapping("/json")
public Response json(HttpResponse response) {
response.setContentType(HeaderValue.ContentType.APPLICATION_JSON_UTF8);
return new Response("Hello", "World");
}
public static void main(String[] args) {
long start = System.currentTimeMillis();
// 定义服务器接受的消息类型以及各类消息对应的处理器
FeatCloud.cloudServer(options -> {
options
.setPackages("tech.smartboot.feat.demo.benchmark");
}).listen(8082);
System.out.println("启动耗时:" + (System.currentTimeMillis() - start));
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。