代码拉取完成,页面将自动刷新
#CiWeb#
基于netty做了简单封装,方便快捷web接口开发。
支持开发时热更新
支持静态文件 和 websocket
#example#
public class Demo { public static void main(String[] args) { CiConfig config = new CiConfig(); config.port(8080).fileDir("www").filePath("/img/;/js/;/css/") .handlerPackage("ci.demo") //框架搜索class文件时,限定某个package下面扫描 .handlerDir("bin/"); //设置脚本搜索目录 或者 jar文件,具体看自己运行环境设置 //配置文件可用- 看config-file目录下的模版 CiService service = new CiService(config); service.start(); service.dev();// 此方法设置后,会监控脚本 变化,实现热更新 } }
http://domain/ClassName/MethodName?web参数
package ci.demo; import ci.web.core.CiContext; public class User { //http://127.0.0.1/user/hello public void hello(CiContext ctx){ System.out.println("User.hello#"+ctx.params().toJSONString()); ctx.send("User.hello"); } //http://127.0.0.1/user/login?email=test@xx.com&pwd=xxx public void login(String email, String passWord){ System.out.println("User.login#"+email+" : "+passWord); ctx.send("User.login"); } //http://127.0.0.1/user/logout public String logout(){ return "logout-ok"; } }
包路径说明
ci.web.core : http请求/http响应
ci.web.router : 路由处理,将请求解析到对应接口处理
ci.web.codec : http/websocket解码
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型