Skip to content

Commit c85c56f

Browse files
authored
Update README.md
1 parent 4130c21 commit c85c56f

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

README.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -87,50 +87,50 @@ In this project you can fast publish your API and schedule task, dynamic edit yo
8787
![https://raw.githubusercontent.com/wiki/NLPchina/Jcoder/3.png](https://raw.githubusercontent.com/wiki/NLPchina/Jcoder/3.png)
8888

8989

90-
*** how to use example by action
90+
- ##### how to use example by action
9191

92-
````
93-
package org.nlpcn.jcoder.run.java;
94-
95-
import org.nlpcn.jcoder.run.annotation.Cache;
96-
97-
/**
98-
* this is a api example
99-
*
100-
* @author ansj
101-
*
102-
*/
103-
@Single(false) // default is true
104-
public class ApiExampleAction {
92+
````
93+
package org.nlpcn.jcoder.run.java;
10594

106-
@Inject
107-
private Logger log ;
95+
import org.nlpcn.jcoder.run.annotation.Cache;
10896

109-
@Inject
110-
private Dao dao ;
111-
112-
@Execute // publish this function to api !
113-
// use url is
114-
// http://host:port/[className]/methodName?field=value
115-
// http//localhost:8080/ApiExampleAction/method?name=heloo&hello_word=hi
116-
public Object function(HttpServletRequest req, HttpServerResponse rep, String name, @Param("hello_word") Integer helloWord) {
117-
dosomething..
118-
}
119-
120-
@DefaultExecute // publish this function to api !
121-
//http://localhost:8080/ApiExampleAction?user.name=aaa&user.passowrd=bbb
122-
//http://localhost:8080/ApiExampleAction/function2?user.name=aaa&user.passowrd=bbb
123-
//more about http://www.nutzam.com/core/mvc/http_adaptor.html
97+
/**
98+
* this is a api example
99+
*
100+
* @author ansj
101+
*
102+
*/
103+
@Single(false) // default is true
104+
public class ApiExampleAction {
105+
106+
@Inject
107+
private Logger log ;
108+
109+
@Inject
110+
private Dao dao ;
111+
112+
@Execute // publish this function to api !
113+
// use url is
114+
// http://host:port/[className]/methodName?field=value
115+
// http//localhost:8080/ApiExampleAction/method?name=heloo&hello_word=hi
116+
public Object function(HttpServletRequest req, HttpServerResponse rep, String name, @Param("hello_word") Integer helloWord) {
117+
dosomething..
118+
}
119+
120+
@DefaultExecute // publish this function to api !
121+
//http://localhost:8080/ApiExampleAction?user.name=aaa&user.passowrd=bbb
122+
//http://localhost:8080/ApiExampleAction/function2?user.name=aaa&user.passowrd=bbb
123+
//more about http://www.nutzam.com/core/mvc/http_adaptor.html
124+
125+
@Cache(time=10,size=1000,block=false) // time SECONDS , block if false use asynchronous
126+
public Object function2(@Param("..") User user) {
127+
128+
dosomething..
129+
}
124130

125-
@Cache(time=10,size=1000,block=false) // time SECONDS , block if false use asynchronous
126-
public Object function2(@Param("..") User user) {
127-
128-
dosomething..
129131
}
130-
131-
}
132-
133-
````
132+
133+
````
134134

135135

136136
* [创建中文分词服务例子](http://www.jianshu.com/p/1fcf5327107a)

0 commit comments

Comments
 (0)