Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/code4craft/express.java
A tiny RESTful web framework with embed server. Used as instead of JMX for cross-language communication.
https://github.com/code4craft/express.java
Last synced: 4 days ago
JSON representation
A tiny RESTful web framework with embed server. Used as instead of JMX for cross-language communication.
- Host: GitHub
- URL: https://github.com/code4craft/express.java
- Owner: code4craft
- Created: 2013-11-17T00:26:15.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-21T15:41:53.000Z (over 10 years ago)
- Last Synced: 2024-10-30T02:59:02.943Z (13 days ago)
- Language: Java
- Homepage:
- Size: 241 KB
- Stars: 12
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
express.java
=====
>A tiny RESTful web framework with embed server. Used as instead of JMX for cross-language communication.## Features:
* ### Convention over Configuration
No xml and no annotation. Just write an application by API in Java.
```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();
```* ### For Java8
```JAVA
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();
}
}
```## License:
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)