-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,22 @@ | ||
package org.nlpcn.jcoder.run.java; | ||
|
||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
import org.apache.log4j.Logger; | ||
import org.nlpcn.jcoder.domain.User; | ||
import org.nlpcn.jcoder.run.annotation.DefaultExecute; | ||
import org.nlpcn.jcoder.run.annotation.Execute; | ||
import org.nlpcn.jcoder.util.StaticValue; | ||
import org.nutz.ioc.loader.annotation.Inject; | ||
import org.nutz.mvc.annotation.Param; | ||
import org.nutz.mvc.Mvcs; | ||
|
||
public class ApiTest { | ||
|
||
@Inject | ||
private Logger log; | ||
|
||
@Inject | ||
private User user; | ||
|
||
@Execute | ||
public String wangchao(String name) { | ||
log.info("jetty hello wangchao !" + name); | ||
|
||
return "jetty hello wangchao !" + name; | ||
} | ||
|
||
@Execute | ||
public String test(@Param("name") String name, String bbb) throws InterruptedException { | ||
log.info("execute----------------aaa----------"); | ||
Thread.sleep(100000L); | ||
return "execute : " + user.getName() + " " + name + "\t" + bbb; | ||
} | ||
|
||
@DefaultExecute | ||
public String defaultTest() throws InterruptedException { | ||
Thread.sleep(100000L); | ||
return "default : " + user.getName(); | ||
} | ||
|
||
public static void main(String[] args) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { | ||
|
||
ApiTest tr = new ApiTest(); | ||
|
||
Method method = tr.getClass().getDeclaredMethod("test", String.class); | ||
|
||
Object invoke = method.invoke(tr, new Object[] { null }); | ||
|
||
System.out.println(invoke); | ||
log.info(Mvcs.getReq().getServerName().matches("127.0.*")); | ||
|
||
return StaticValue.OK; | ||
} | ||
|
||
} |