From ba4d39e3754ed4629320ae2b3b3c456fc539fa40 Mon Sep 17 00:00:00 2001 From: "James M.Z" Date: Wed, 18 Apr 2018 13:42:43 +0800 Subject: [PATCH 1/4] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index da0dfa4..ec7bae3 100755 --- a/README.md +++ b/README.md @@ -47,6 +47,10 @@ A demonstration for comet technology: Live Demo Site: * http://smalltalk.tinystruct.org/ +* http://smalltalk.tinystruct.org/?q=say/Praise%20to%20the%20Lord!
+* http://smalltalk.tinystruct.org/?q=praise
+* http://smalltalk.tinystruct.org/?q=youhappy
+* http://smalltalk.tinystruct.org/?q=say/%E4%BD%A0%E7%9F%A5%E9%81%93%E5%85%A8%E4%B8%96%E7%95%8C%E6%9C%80%E7%95%85%E9%94%80%E7%9A%84%E4%B9%A6%E6%98%AF%E5%93%AA%E4%B8%80%E6%9C%AC%E4%B9%A6%E5%90%97%EF%BC%9F Results in your browser should be: From 8d3dbe60c3b32aca655e2ce2e19f72952e957e6a Mon Sep 17 00:00:00 2001 From: "James M.Z" Date: Wed, 13 Jun 2018 14:33:25 +0800 Subject: [PATCH 2/4] Update hello.java --- src/tinystruct/examples/hello.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/tinystruct/examples/hello.java b/src/tinystruct/examples/hello.java index 86cb1c5..4477321 100644 --- a/src/tinystruct/examples/hello.java +++ b/src/tinystruct/examples/hello.java @@ -76,25 +76,6 @@ public static void main(String[] args) throws ApplicationException, Instantiatio ApplicationManager.call("say/Merry Christmas!", null); } - String path="i/say/hi/James/How are you?"; - int pos = -1; - String tpath = path; - StringBuffer buffer=new StringBuffer(); - buffer.delete(0, 1); - while ((pos = tpath.lastIndexOf('/'))!=-1) { - tpath = tpath.substring(0, pos); - System.out.println("route:"+tpath); -// action = actions.getAction(tpath, method); - - if(true) { - String arg = path.substring(pos+1); - String[] _args = arg.split("/"); - - for(String arg1 : _args) - System.out.println(arg1); - } - } - } } From b0749c1af3c50bdcf2e10cee4212f1402682e9d1 Mon Sep 17 00:00:00 2001 From: "James M.Z" Date: Thu, 12 Jul 2018 13:58:26 +0800 Subject: [PATCH 3/4] Delete hello.java --- src/tinystruct/examples/hello.java | 81 ------------------------------ 1 file changed, 81 deletions(-) delete mode 100644 src/tinystruct/examples/hello.java diff --git a/src/tinystruct/examples/hello.java b/src/tinystruct/examples/hello.java deleted file mode 100644 index 4477321..0000000 --- a/src/tinystruct/examples/hello.java +++ /dev/null @@ -1,81 +0,0 @@ -package tinystruct.examples; - -import org.tinystruct.AbstractApplication; -import org.tinystruct.Application; -import org.tinystruct.ApplicationException; -import org.tinystruct.system.ApplicationManager; -import org.tinystruct.system.ClassFileLoader; -import org.tinystruct.system.Configuration; -import org.tinystruct.system.Settings; - -public class hello extends AbstractApplication { - - @Override - public void init() { - // TODO Auto-generated method stub - this.setAction("say", "say"); - this.setAction("smile", "smile"); - this.setAction("render", "render"); - } - - @Override - public String version() { - System.out.println("tinystruct version 2.0.1"); - return null; - } - - public String say(String words){ - return words; - } - - public String smile() throws ApplicationException{ - return ":)"; - } - - public hello render() { - return this; - } - - /** - * @param args - * @throws ApplicationException - * @throws IllegalAccessException - * @throws InstantiationException - */ - public static void main(String[] args) throws ApplicationException, InstantiationException, IllegalAccessException { - // Praise to the Lord! - ApplicationManager.install(new hello()); - - // to print 'Hello World' - ApplicationManager.call("say/Hello World", null); // Hello World - - // or... - Application app=ApplicationManager.get( hello.class.getName()); - app.invoke("say", new Object[]{"

Hello, World!

"}); //

Hello, World!

- app.invoke("say", new Object[]{"

Bye!

"}); //

Bye!

- - // or... - // http://localhost:8080/?q=say/Hello World - - // to run nothing - ApplicationManager.call("smile", null); // Looks nothing - - // What will be happened? - System.out.println(ApplicationManager.call("smile", null)); // Will render the default template - - // Use ClassFileLoader to load Java class - ClassFileLoader loader = ClassFileLoader.getInstance(); - - Configuration config = new Settings("/application.properties"); - config.set("default.apps.path", "WEB-INF/classes"); - config.set("default.apps.package", "tinystruct.examples"); - - Class clz = loader.findClass("hello"); - if(clz!=null && clz.getSuperclass().equals(AbstractApplication.class)) { - ApplicationManager.install((Application) clz.newInstance()); - ApplicationManager.call("say/Merry Christmas!", null); - } - - } - -} From 512b745478845286160cf9bd5eee1a83cf8f7951 Mon Sep 17 00:00:00 2001 From: "James M.Z" Date: Thu, 12 Jul 2018 14:11:54 +0800 Subject: [PATCH 4/4] Update pom.xml --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 3a4c97a..6fe7962 100644 --- a/pom.xml +++ b/pom.xml @@ -21,8 +21,8 @@ UTF-8 - 1.8 - 1.8 + 1.7 + 1.7 ${basedir}/src/main/java @@ -34,4 +34,4 @@ - \ No newline at end of file +