| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
A tiny RESTful web framework with embed server. Used as instead of JMX for cross-language communication.
No xml and no annotation. Just write an application by API in Java.
WebServer.jettyServer().get("/", new AjaxController() {
@Override
public Object ajax(ParamMap params) {
return ResultMap.create().put("code", 200).put("msg", "ok");
}
}).get("/echo", new AjaxController() {
@Override
public Object ajax(ParamMap params) {
return params;
}
}).get("/echo/${id}", new AjaxController() {
@Override
public Object ajax(ParamMap params) {
return ResultMap.create().put("id", params.getInt("id"));
}
}).port(8080).start();public class RestAjax {
public static void main(String[] args) throws Exception {
WebServer.jettyServer().get("/", (params) -> {
return ResultMap.create().put("code", 200).put("msg", "ok");
}).get("/echo", (params) -> {
return params;
}).get("/echo/${id}", (params) -> {
return ResultMap.create().put("id", params.getInt("id"));
}).port(8080).start();
}
}| Back | FazBrowse Home | New Git URL |