代码拉取完成,页面将自动刷新
一、快速入门
1.简单配置 resources下server-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<params>
<param name="server.netty.port" value="11000" /><!--http服务监听端口-->
<param name="server.intf.bind" value="com.lion.httpapi.api" /><!--api类包路径-->
<param name="server.max.thread" value="100" /><!--最大并发数量,默认100-->
</params>
</root>
2.查看test包下示例:
@HttpInterface 注解表示公开该类的方法 @HttpPath 注解表示路径,例如:
@HttpInterface
@HttpPath("/demo")
public class DemoAPI {
@HttpPath("/helloString")
public void helloString(ApiRequest request, ApiResponse response) {
DemoModel data = request.getData(DemoModel.class);
response.setData("hello "+data.getName());
}
……
}
void helloString(ApiRequest request, ApiResponse response) 方法的请求路径为/demo/helloString
二、约定 api方法的写法是固定的 public void methodName(ApiRequest request, ApiResponse response)
三、启动服务 new HttpServer().start();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。