Permalink
Browse files

rewrite of docs, and examples, new site up at http://rhino-for-webapp…

…s.appspot.com/ This is javascript for Google AppsEngine in its simplest form, ready for the cloud today. No fuss, no muss, no specifications, runs on your neighborhood server farm, including google.  Comes bundled with jetty so just do ./server.sh start and go to http://localhost:8080/ - Thatcher
  • Loading branch information...
1 parent 07e451f commit a9f815028a455aae284bd3c22bcaaa9352c52316 thatcher committed Mar 30, 2010
Showing with 52,545 additions and 17,419 deletions.
  1. +39 −14 README.textile
  2. +4 −0 WEB-INF/appengine-web.xml
  3. BIN WEB-INF/classes/claypool/server/FileListener.class
  4. BIN WEB-INF/classes/claypool/server/FileMonitor$1.class
  5. BIN WEB-INF/classes/claypool/server/FileMonitor$FileMonitorNotifier.class
  6. BIN WEB-INF/classes/claypool/server/FileMonitor.class
  7. BIN WEB-INF/classes/claypool/server/Log4jInit.class
  8. BIN WEB-INF/classes/claypool/server/RequestHandler.class
  9. BIN WEB-INF/classes/claypool/server/Servlet.class
  10. +18 −6 WEB-INF/classes/claypool/server/Servlet.java
  11. BIN WEB-INF/classes/claypool/server/Shell.class
  12. +27 −12 WEB-INF/classes/claypool/server/Shell.java
  13. +9 −17 WEB-INF/examples/envjs/dispatcher.js
  14. +12,008 −0 WEB-INF/examples/envjs/env.rhino.js
  15. +0 −23 WEB-INF/examples/envjs/index.html
  16. +0 −50 WEB-INF/examples/envjs/request.html
  17. +11 −8 WEB-INF/examples/envjs/shell.js
  18. +0 −40 WEB-INF/examples/envjs/status.html
  19. +0 −8,335 WEB-INF/examples/lib/env.0.9.0.js
  20. +0 −8,606 WEB-INF/examples/lib/env.rhino.0.9.1.js
  21. +0 −24 WEB-INF/jsx/dispatcher.js
  22. +0 −56 WEB-INF/jsx/index.jsx
  23. +0 −53 WEB-INF/jsx/request.jsx
  24. +0 −19 WEB-INF/jsx/shell.js
  25. +0 −48 WEB-INF/jsx/status.jsx
  26. +3 −3 WEB-INF/logging.conf
  27. +1 −0 WEB-INF/root.jsp
  28. +30 −25 WEB-INF/web.xml
  29. +1 −1 build.xml
  30. +35 −0 css/blueprint/ie.css
  31. BIN css/blueprint/plugins/buttons/icons/cross.png
  32. BIN css/blueprint/plugins/buttons/icons/key.png
  33. BIN css/blueprint/plugins/buttons/icons/tick.png
  34. +32 −0 css/blueprint/plugins/buttons/readme.txt
  35. +97 −0 css/blueprint/plugins/buttons/screen.css
  36. +14 −0 css/blueprint/plugins/fancy-type/readme.txt
  37. +71 −0 css/blueprint/plugins/fancy-type/screen.css
  38. BIN css/blueprint/plugins/link-icons/icons/doc.png
  39. BIN css/blueprint/plugins/link-icons/icons/email.png
  40. BIN css/blueprint/plugins/link-icons/icons/external.png
  41. BIN css/blueprint/plugins/link-icons/icons/feed.png
  42. BIN css/blueprint/plugins/link-icons/icons/im.png
  43. BIN css/blueprint/plugins/link-icons/icons/pdf.png
  44. BIN css/blueprint/plugins/link-icons/icons/visited.png
  45. BIN css/blueprint/plugins/link-icons/icons/xls.png
  46. +18 −0 css/blueprint/plugins/link-icons/readme.txt
  47. +40 −0 css/blueprint/plugins/link-icons/screen.css
  48. +10 −0 css/blueprint/plugins/rtl/readme.txt
  49. +109 −0 css/blueprint/plugins/rtl/screen.css
  50. BIN css/blueprint/plugins/silksprite/__MACOSX/sprites/._.DS_Store
  51. BIN css/blueprint/plugins/silksprite/__MACOSX/sprites/._sprite.css
  52. BIN css/blueprint/plugins/silksprite/__MACOSX/sprites/._sprites.png
  53. BIN css/blueprint/plugins/silksprite/__MACOSX/sprites/._test.htm
  54. BIN css/blueprint/plugins/silksprite/sprites.png
  55. +1 −0 css/blueprint/plugins/silksprite/sprites/sprite.css
  56. BIN css/blueprint/plugins/silksprite/sprites/sprites.png
  57. +1,006 −0 css/blueprint/plugins/silksprite/sprites/test.htm
  58. +3,007 −0 css/blueprint/plugins/silksprite/test.htm
  59. +30 −0 css/blueprint/print.css
  60. +256 −0 css/blueprint/screen.css
  61. +65 −0 css/blueprint/src/forms.css
  62. +281 −0 css/blueprint/src/grid.css
  63. BIN css/blueprint/src/grid.png
  64. +76 −0 css/blueprint/src/ie.css
  65. +85 −0 css/blueprint/src/print.css
  66. +38 −0 css/blueprint/src/reset.css
  67. +105 −0 css/blueprint/src/typography.css
  68. +1 −0 css/sharethis.css
  69. +114 −0 css/site-admin.css
  70. +221 −0 css/site.css
  71. +4,011 −0 css/sprite.css
  72. BIN css/sprites.png
  73. BIN dist/claypool.0.4.7.jar
  74. BIN dist/claypool.0.4.9.jar
  75. BIN dist/claypool.jar
  76. +144 −0 html/envjs.html
  77. BIN images/button.png
  78. BIN images/claypool-button.png
  79. BIN images/icon-blue.png
  80. BIN images/icon-brown.png
  81. +0 −1 index.jsp
  82. BIN {server → jetty}/.DS_Store
  83. 0 {server → jetty}/README.txt
  84. 0 {server → jetty}/VERSION.txt
  85. BIN {server → jetty}/bin/Jetty-Service.exe
  86. 0 {server → jetty}/bin/build_release_bundles.sh
  87. 0 {server → jetty}/bin/jetty-service.conf
  88. 0 {server → jetty}/bin/jetty.sh
  89. 0 {server → jetty}/contexts/README.TXT
  90. 0 server/contexts/jquery.claypool.xml → jetty/contexts/root.xml
  91. 0 {server → jetty}/etc/jdbcRealm.properties
  92. 0 {server → jetty}/etc/jetty-ajp.xml
  93. 0 {server → jetty}/etc/jetty-bio.xml
  94. 0 {server → jetty}/etc/jetty-jaas.xml
  95. 0 {server → jetty}/etc/jetty-jmx.xml
  96. 0 {server → jetty}/etc/jetty-logging.xml
  97. 0 {server → jetty}/etc/jetty-plus.xml
  98. 0 {server → jetty}/etc/jetty-setuid.xml
  99. 0 {server → jetty}/etc/jetty-ssl.xml
  100. 0 {server → jetty}/etc/jetty-sslengine.xml
  101. 0 {server → jetty}/etc/jetty-stats.xml
  102. 0 {server → jetty}/etc/jetty-win32-service.xml
  103. 0 {server → jetty}/etc/jetty.xml
  104. BIN {server → jetty}/etc/keystore
  105. 0 {server → jetty}/etc/login.conf
  106. 0 {server → jetty}/etc/login.properties
  107. 0 {server → jetty}/etc/realm.properties
  108. 0 {server → jetty}/etc/webdefault.xml
  109. BIN {server → jetty}/lib/annotations/geronimo-annotation_1.0_spec-1.0.jar
  110. BIN {server → jetty}/lib/annotations/jetty-annotations-6.1.14.jar
  111. BIN {server → jetty}/lib/cometd/cometd-api-1.0.beta4.jar
  112. BIN {server → jetty}/lib/cometd/cometd-jetty-6.1.14.jar
  113. BIN {server → jetty}/lib/ext/jetty-ajp-6.1.14.jar
  114. BIN {server → jetty}/lib/ext/jetty-client-6.1.14.jar
  115. BIN {server → jetty}/lib/ext/jetty-html-6.1.14.jar
  116. BIN {server → jetty}/lib/ext/jetty-java5-threadpool-6.1.14.jar
  117. BIN {server → jetty}/lib/ext/jetty-rewrite-handler-6.1.14.jar
  118. BIN {server → jetty}/lib/ext/jetty-servlet-tester-6.1.14.jar
  119. BIN {server → jetty}/lib/ext/jetty-setuid-6.1.14.jar
  120. BIN {server → jetty}/lib/ext/jetty-sslengine-6.1.14.jar
  121. BIN {server → jetty}/lib/ext/libsetuid.so
  122. BIN {server → jetty}/lib/jetty-6.1.14.jar
  123. BIN {server → jetty}/lib/jetty-util-6.1.14.jar
  124. BIN {server → jetty}/lib/jre1.5/jetty-util5-6.1.14.jar
  125. BIN {server → jetty}/lib/jsp-2.0/ant-1.6.5.jar
  126. BIN {server → jetty}/lib/jsp-2.0/commons-el-1.0.jar
  127. BIN {server → jetty}/lib/jsp-2.0/jasper-compiler-5.5.15.jar
  128. BIN {server → jetty}/lib/jsp-2.0/jasper-compiler-jdt-5.5.15.jar
  129. BIN {server → jetty}/lib/jsp-2.0/jasper-runtime-5.5.15.jar
  130. BIN {server → jetty}/lib/jsp-2.0/jcl104-over-slf4j-1.3.1.jar
  131. BIN {server → jetty}/lib/jsp-2.0/jsp-api-2.0.jar
  132. BIN {server → jetty}/lib/jsp-2.0/slf4j-api-1.3.1.jar
  133. BIN {server → jetty}/lib/jsp-2.0/slf4j-simple-1.3.1.jar
  134. BIN {server → jetty}/lib/jsp-2.0/xercesImpl-2.6.2.jar
  135. BIN {server → jetty}/lib/jsp-2.0/xmlParserAPIs-2.6.2.jar
  136. BIN {server → jetty}/lib/jsp-2.1/ant-1.6.5.jar
  137. BIN {server → jetty}/lib/jsp-2.1/core-3.1.1.jar
  138. BIN {server → jetty}/lib/jsp-2.1/jsp-2.1.jar
  139. BIN {server → jetty}/lib/jsp-2.1/jsp-api-2.1.jar
  140. BIN {server → jetty}/lib/management/jetty-management-6.1.14.jar
  141. BIN {server → jetty}/lib/management/mx4j/mx4j-3.0.1.jar
  142. BIN {server → jetty}/lib/management/mx4j/mx4j-tools-3.0.1.jar
  143. BIN {server → jetty}/lib/naming/activation-1.1.jar
  144. BIN {server → jetty}/lib/naming/jetty-naming-6.1.14.jar
  145. BIN {server → jetty}/lib/naming/mail-1.4.jar
  146. BIN {server → jetty}/lib/plus/jetty-plus-6.1.14.jar
  147. BIN {server → jetty}/lib/servlet-api-2.5-6.1.14.jar
  148. BIN {server → jetty}/lib/win32/jetty-win32-service-java-6.1.14.jar
  149. BIN {server → jetty}/lib/win32/wrapper.dll
  150. BIN {server → jetty}/lib/win32/wrapper.jar
  151. BIN {server → jetty}/lib/xbean/jetty-xbean-6.1.14.jar
  152. 0 {server → jetty}/logs/2010_03_10.request.log
  153. 0 {server → jetty}/logs/tmp.txt
  154. 0 {server → jetty}/resources/log4j.properties
  155. BIN {server → jetty}/start.jar
  156. BIN {server → jetty}/webapps/.DS_Store
  157. 0 {server → jetty}/webapps/README.TXT
  158. BIN {server → jetty}/webapps/cometd.war
  159. +12,008 −0 lib/env.rhino.js
  160. +672 −0 lib/firebug.js
  161. +47 −0 lib/firebug/.svn/all-wcprops
  162. +115 −0 lib/firebug/.svn/entries
  163. +1 −0 lib/firebug/.svn/format
  164. +5 −0 lib/firebug/.svn/prop-base/errorIcon.png.svn-base
  165. +5 −0 lib/firebug/.svn/prop-base/infoIcon.png.svn-base
  166. +5 −0 lib/firebug/.svn/prop-base/warningIcon.png.svn-base
  167. BIN lib/firebug/.svn/text-base/errorIcon.png.svn-base
  168. +209 −0 lib/firebug/.svn/text-base/firebug.css.svn-base
  169. +23 −0 lib/firebug/.svn/text-base/firebug.html.svn-base
  170. +672 −0 lib/firebug/.svn/text-base/firebug.js.svn-base
  171. +10 −0 lib/firebug/.svn/text-base/firebugx.js.svn-base
  172. BIN lib/firebug/.svn/text-base/infoIcon.png.svn-base
  173. BIN lib/firebug/.svn/text-base/warningIcon.png.svn-base
  174. BIN lib/firebug/errorIcon.png
  175. +209 −0 lib/firebug/firebug.css
  176. +23 −0 lib/firebug/firebug.html
  177. +672 −0 lib/firebug/firebug.js
  178. +10 −0 lib/firebug/firebugx.js
  179. BIN lib/firebug/infoIcon.png
  180. BIN lib/firebug/warningIcon.png
  181. +5,951 −0 lib/jquery.claypool.js
  182. +6,081 −0 lib/jquery.js
  183. +250 −0 lib/jquery.livequery.js
  184. +809 −0 plugins/jquery.gdb.js
  185. +25 −0 plugins/jquery.gdb.rest.js
  186. +385 −0 plugins/jquery.json.js
  187. +200 −0 plugins/jquery.loremipsum.js
  188. +27 −0 scripts/dispatch.js
  189. +8 −0 scripts/helloworld/dispatcher.js
  190. +10 −0 scripts/helloworld/hello.js
  191. +16 −0 scripts/helloworld/shell.js
  192. +70 −0 scripts/site.js
  193. +6 −0 server.sh
  194. +0 −50 server/contexts/README-test-jndi.txt
  195. +0 −28 server/contexts/javadoc.xml
  196. +21 −0 shell.js
  197. +126 −0 templates/base.js
  198. +16 −0 templates/errors.js
  199. +50 −0 templates/pages/examples.js
  200. +458 −0 templates/pages/home.js
  201. +38 −0 test/index.html
  202. +107 −0 test/qunit.env.js
  203. +119 −0 test/qunit/qunit.css
  204. +1,061 −0 test/qunit/qunit.js
  205. +7 −0 test/testrunner.js
View
@@ -1,32 +1,57 @@
-h1. rhino-for-webapps : A simple javascipting platform for java serlvet containers
+h1. Rhino-for-Webapps : A JavaScript bridge for Google App Engine
-<strong>Developed by Chris Thatcher</strong>
+Rhino-for-webapps is a simple bridge technology for enabling development of
+webapps with javascript in proven containers like Jetty, Tomcat, and of course
+Google AppEngine. It provides as little as possible and is not itself an
+application framework, only the lowest common denominator.
-h3. Major Contributers:
+Rhino is of course Mozilla's wonderful javascript engine for use in the jvm,
+giving you both the elegance of the javascript language and E4X along with
+the leverage of being able to script with java libraries for image manipulation,
+data storage and analytics, network i/o operations etc.
-"Chris Thatcher":http://github.com/thatcher
+h2. Web Site
-h2. GitHub repositories:
+"http://rhino-for-webapps.appspot.com/":http://rhino-for-webapps.appspot.com/
-"GitHub rhino-for-webapps":http://github.com/thatcher/rhino-for-webapps/
+(witten with Javascript, running on this software, on Google AppEngine)
-h2. Mailing List:
-
-"GoogleGroups rhino-for-webapps":http://groups.google.com/group/rhino-for-webapps/
+h2. Running with bundled Jetty server:
-h2. Lighthouse (Bug Tracking):
+@$>cd /path/to/rhino-for-webapps/@
+@$>./server.sh start@
+
+Then visit http://localhost:8080/
-"Lighthouse rhino-for-webapps":http://claypooljs.lighthouseapp.com/projects/26082-rhino-for-webapps/
+h2. Running in Tomcat
+
+Put it in tomcat/webapps/ROOT and visit http://localhost:8080/
+
+h2. Running in Google App Engine
-h2. Building:
+@$> /path/to/appengine/bin/dev_appserver.sh /path/to/rhino-for-webapps/@
- Just put it in tomcat/webapps and visit http://localhost:8080/rhino-for-webapps/ and you should see 'Hello World'
+h2. Building Source
* project is ready to go
- * run "ant compile" (project should be located in tomcat/webapps to have access to the servlet.jar)
+ * source files lib in WEB-INF/classes
+
+@$> ant @
+
h3. Related Technology Links
"Rhino - Java-based JavaScript engine":http://www.mozilla.org/rhino/
+h2. GitHub repositories:
+
+"GitHub rhino-for-webapps":http://github.com/thatcher/rhino-for-webapps/
+
+h2. Mailing List:
+
+"GoogleGroups rhino-for-webapps":http://groups.google.com/group/rhino-for-webapps/
+
+h2. Lighthouse (Bug Tracking):
+
+"Lighthouse rhino-for-webapps":http://claypooljs.lighthouseapp.com/projects/26082-rhino-for-webapps/
@@ -0,0 +1,4 @@
+<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
+ <application>rhino-for-webapps</application>
+ <version>1</version>
+</appengine-web-app>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -36,17 +36,29 @@
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
- String localBase = getServletConfig().getServletContext().getRealPath("/").toString();
+ String localBase = getServletConfig().
+ getServletContext().
+ getRealPath("/").toString();
this.contextPath = localBase;
this.base = config.getInitParameter("script-base")!=null?
localBase + config.getInitParameter("script-base"):
- localBase + "/WEB-INF/jsx/";
- this.shellFile = config.getInitParameter("shell");
- this.dispatchFunction = config.getInitParameter("dispatch-function");
- this.activeReload = config.getInitParameter("active-reload")!=null?
+ localBase + "/";
+ this.shellFile =
+ config.getInitParameter("shell")!=null?
+ config.getInitParameter("shell"):
+ "shell.js";
+ this.dispatchFunction =
+ config.getInitParameter("dispatch-function")!=null?
+ config.getInitParameter("dispatch-function"):
+ "dispatch";
+ this.activeReload =
+ config.getInitParameter("active-reload")!=null?
config.getInitParameter("active-reload"):
"true";
- this.optimizationLevel = config.getInitParameter("opt-level");
+ this.optimizationLevel =
+ config.getInitParameter("opt-level")!=null?
+ config.getInitParameter("opt-level"):
+ "-1";
if(this.shell == null){
//load global shell
Binary file not shown.
@@ -39,13 +39,19 @@ public Shell(String contextPath, String basePath, String appFile, String activeR
this.contextPath = contextPath;
this.basePath = basePath;
this.activeReload = activeReload;
- if(activeReload.equalsIgnoreCase("true")){
- logger.info("Will monitor local files for changes: "+activeReload);
- monitor = new FileMonitor (3000);
- }else{
- logger.info("Will not monitor local files for changes: "+activeReload);
- monitor = null;
- }
+ try{
+ if(activeReload.equalsIgnoreCase("true")){
+ logger.info("Will monitor local files for changes: "+activeReload);
+ monitor = new FileMonitor (3000);
+ }else{
+ logger.info("Will not monitor local files for changes: "+activeReload);
+ monitor = null;
+ }
+ }catch(Exception e){
+ logger.warn("Will not monitor local files. Monitors may not be allowed."
+ +e.toString());
+ monitor = null;
+ }
cx = Context.enter();
cx.initStandardObjects(this);
this.optimizationLevel = optimizationLevel;
@@ -196,21 +202,30 @@ private void processAbsoluteFile(String absoluteFileName) {
}
public void fileChanged (File file) {
- //Because the Context/Thread relationship the smartest thing I could
- //think to do is modify/touch WEB-INF/web.xml to force a reload.
logger.info("Detected change to application sources. Reloading...");
+ //AppEngine seems to honor this
+ /*try{
+ logger.info("Trying default reload trigger ("+this.contextPath +"/WEB-INF/appengine-web.xml)");
+ File webXml = new File(this.contextPath + "/WEB-INF/appengine-web.xml");
+ webXml.setLastModified(new java.util.Date().getTime());
+ return;
+ }catch(Exception e){
+ //ignore
+ logger.error(e.toString());
+ }*/
+ //Tomcat
try{
logger.info("Trying default reload trigger ("+this.contextPath +"/WEB-INF/web.xml)");
File webXml = new File(this.contextPath + "/WEB-INF/web.xml");
webXml.setLastModified(new java.util.Date().getTime());
}catch(Exception e){
//ignore logger.error(ioe.toString());
}
- //Dxmn jetty thinks maven is the shxt.
+ //Jetty
try{
logger.info("Trying jetty reload trigger ( "+
- this.contextPath + "/server/contexts/jquery.claypool.xml)");
- File webXml = new File(this.contextPath + "/server/contexts/jquery.claypool.xml");
+ this.contextPath + "/jetty/contexts/contexts.xml)");
+ File webXml = new File(this.contextPath + "/jetty/contexts/root.xml");
webXml.setLastModified(new java.util.Date().getTime());
}catch(Exception e){
//ignore logger.error(ioe.toString());
@@ -1,26 +1,18 @@
//In this simple example, we've already preloaded
//env.rhino.js
-var context_path = "";
-var dispatch_envjs = function(request, response){
+var url = "";
+var dispatch = function(request, response){
- context_path =
- request.attributes['javax.servlet.forward.context_path']||
- cwd;
+ url = 'http://'+request.serverName;
+ if(request.serverPort)
+ url += ':'+request.serverPort;
+ url += '/html/envjs.html';
- print("\n\t<-@Dispatching request for envjs example@->\n" + context_path);
+ print("Dispatching request for envjs example" + url);
- if(request.parameters.request){
- window.request = request;
- window.location = context_path+'/WEB-INF/examples/envjs/request.html';
- response.body = window.document.innerHTML;
- }else if(request.parameters.status){
- window.location = context_path+'/WEB-INF/examples/envjs/status.html';
- response.body = window.document.innerHTML;
- }else{
- window.location = context_path+'/WEB-INF/examples/envjs/index.html';
- response.body = window.document.innerHTML;
- }
+ window.location = url;
+ response.body = window.document.innerHTML;
response.headers = {
status : 200,
Oops, something went wrong.

0 comments on commit a9f8150

Please sign in to comment.