Permalink
Browse files

V0.3

  • Loading branch information...
0 parents commit 2151b43704b15efa0cda8c5c68b94d85cd756248 @mrohad committed Aug 19, 2010
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Alligator</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path=""/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.JRE_CONTAINER
@@ -0,0 +1 @@
+Global
Binary file not shown.
@@ -0,0 +1,33 @@
+Change LOG 0.3
+================================
+Features:
+1) Supports multi-node with session-scope and application-scope utilizing memcached.
+
+BugFixes
+1) bugs with static files support
+
+
+Change LOG 0.29
+================================
+Features:
+1) Compiling each JSSP file to JS file, upon a second use it evals/requires(the js file).
+
+BugFixes
+1) forward() is now working again
+
+Change LOG 0.28
+================================
+Features:
+1) Error details, on debug_mode Alligator generates a file by the name debugging.js, and add the error line to the response.
+
+
+
+
+
+Change LOG 0.27
+================================
+Features:
+1) multinode support - no shared memory yet
+
+BugFixes
+1) One can now write a server-side script with comments (//)
21 LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2010 Noah Sloan <http://noahsloan.com>
+and Mark Hansen <http://markhansen.co.nz>
+and Ohad Assulin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -0,0 +1,121 @@
+Alligator is a simple application server built on top of AntiNode and Node.js
+
+Latest Version 0.3
+
+# Usage
+
+Run it from the command line.
+
+ $ node alligator.js
+
+Requires Node.JS v0.1.99 or greater.
+If you want to bind to a port under 1024, you'll need to run node with special
+privileges.
+
+# Configuration
+
+Configuration is through a JSON text file - `settings.json` in
+the same folder as `alligator.js`.
+
+Example settings file:
+
+ {
+ "web_app_name" : "Alligator TestApp",
+ "port" : 82,
+ "path" : {
+ "root":"/home/vadmin/Alligator/WWW/",
+ "lib":"/home/vadmin/Alligator/WWWlib/"
+ },
+ "server_script": {
+ "ext":"jssp",
+ "begin":"<?",
+ "begin_additional_write":"=",
+ "end":"?>",
+ "session_minutes":1,
+ "memcached":{
+ "enable":0,
+ "server":"localhost",
+ "port":11211
+ }
+ },
+ "debug_mode" : 1,
+ "nodes" : 2
+ }
+
+This server listens on port 8080 for HTTP requests.
+
+Explanation of properties:
+
+- `web_app_name` - the name of the current web application
+- `port` - the server listen to this port (default = 80)
+- `path.root` - the root folder for the static and dynamic files (default = WWW)
+- `path.lib` - the folder for JavaScript files that will get loaded automatically - you can access those via lib.fileName.yourStuff (default = None)
+- `server_script.ext` - the extension of files that contains of server-side script (default = jssp)
+- `server_script.begin` - the beginning tag for server-side scripting (default = <?)
+- `server_script.end` - the end tag for server-side scripting (default = ?>)
+- `server_script.session_minutes` - session timeout after X minutes (default = 30)
+- `server_script.memcached` - integration with memcached (Under construction)
+- `debug_mode` - 1 for debug mode, 0 for non-debug mode, on debug mode we add the exception to the response + the log level = debug
+- `nodes` - number of process running this application server( currently we don't support shared memory - under construction)
+
+
+
+# Features
+- Handling request parameters easily (for GET and POST)
+- Session management, including timeout
+- Application scope management
+- Dynamic js loader (the lib folder)
+- User can set the server-side script begin and end tags
+
+When one is writing a script nested to the <? some;JavaScript;Code;In Here;?> tags
+
+He/She can use the following implicit functions/variables:
+
+- `request` for handling the request
+- `request.parameters` to read and write request post/get parameters
+- `responseHead.header` to add headers of the response (e.g. responseHead.header["set-cookie"] = "..";)
+- `responseHead.status` to change the HTTP response status
+- `write(str)` to add string to the response body (or instead one can use the <?=str?> tag)
+- `forward(other.jssp)` to forward the request and response to another server-side resource
+- `sendRedirect(url)` to send HTTP redirect response back to the client
+- `lib.filename.member` to access whatever lib one has loaded
+- `session.put(key,value)` to put anything on the HttpSession
+- `session.get(key)` to get anything from the HttpSession
+- `application.someparam` to get someParam from the application scope
+
+
+
+#Examples
+Ex1.jssp:
+ <? var a = 1+1;?><br/>
+ <? write(a);?>
+Translates to:
+ <br/>2
+Once can achieve the same thing using Ex2.jssp
+ <? var a = 1+1;?><br/>
+ <?=a?>
+
+Once can forward from one jssp to another:
+Exf1.jssp:
+ <? var dbInfo= gettingInfoFromDatabase();
+ request.parameters.db = dbInfo;
+ forward("showTable.jssp");?>
+showTable.jssp:
+ <?=genetrateHTMLTable(request.parameters.db)?>
+
+One can easily redirect:
+ <? if(request.parameters.googleIt=="true")
+ sendRedirect("http://www.google.com");
+ else{>
+ <H1> Welcome...</H1>
+ <?}?>
+
+# Bugs and Contribution
+Please let me know if you find any bug or if you would like to contribute code: mrohad.jsf at gmail
+
+Known Bugs - http://github.com/mrohad/Alligator/blob/master/knowBugs.txt
+
+# Credits
+
+Original code forked from AntiNode @ http://github.com/mhansen/antinode
+We are using Multi-node @ http://github.com/kriszyp/multi-node
@@ -0,0 +1,21 @@
+<HTML>
+
+ <BODY>
+ <?
+ if(application.counter == undefined)
+ application.counter=1;
+ else{
+ application.counter+=1;
+ }
+ var a = 5;
+ a +=4;aasas
+ a+=2;
+ ?>
+ HELLO WORLD<br/>
+ Number of users:
+ <?write(application.counter);?>
+ <br/>
+ <?write(a);?>
+
+ </BODY>
+</HTML>
@@ -0,0 +1,13 @@
+<HTML>
+ <?
+ var a = 1;
+ add("<head><title>nodeJS</title></head>");
+ ?>
+ <BODY>
+ HELLO WORLD
+ <?
+ ss(D);
+ add(a);
+ ?>
+ </BODY>
+</HTML>
@@ -0,0 +1,29 @@
+<HTML>
+ <?
+ write("<head><title>nodeJS</title></head>");
+ ?>
+ <BODY>
+ <?
+ if(application.counter == undefined)
+ application.counter=1;
+ else{
+ application.counter+=1;
+ write(lib.test.abc);
+ }
+ ?>
+ HELLO WORLD<br/>
+ Number of users:
+ <?
+ write(application.counter+"<br/>");
+ if(request.parameters.asas != undefined && request.parameters.asas=="1"){
+ ?>
+ YES!
+ <?}?>
+ <?for (index=0;index<5;index++){ write(index);?>;<? }?>
+ <br/>
+ By Ohad a
+ <?
+ session.put("a",1);
+ ?>
+ </BODY>
+</HTML>
@@ -0,0 +1,28 @@
+(function(log,lib,application,request,responseHead,commands,session) {commands.writeEscapedText("%3CHTML%3E%0A");
+commands.writeEscapedText("%09%09");commands.write("<head><title>Application Scope Counter Tester</title></head>");
+commands.writeEscapedText("%09%3CBODY%3E%0A");
+commands.writeEscapedText("%09%09");
+ var counter = 1;
+ application.get("counter",function(value){
+ log.debug("COUNTER.JSSP, value - " +value);
+ if(value == undefined){
+ application.set("counter",1);
+
+commands.writeEscapedText("%09%09First%20Time%3B%0A");
+commands.writeEscapedText("%09%09%09%09%09%0A");
+commands.writeEscapedText("%09%09%09%09");}else{
+ counter = value+1;
+ application.set("counter",counter);
+
+commands.writeEscapedText("%09%09%0A");
+commands.writeEscapedText("%09%09Number%20of%20users%20%3A%20");commands.write(counter);
+commands.writeEscapedText("%09%09%09%09%0A");
+commands.writeEscapedText("%09%09");}
+commands.writeEscapedText("%09%09%0A");
+commands.writeEscapedText("%09%09%3C/BODY%3E%0A");
+commands.writeEscapedText("%3C/HTML%3E%0A");
+commands.writeEscapedText("%09%09%09%09%09%0A");
+commands.writeEscapedText("%09%09%09%09%0A");
+commands.writeEscapedText("%09%09%09");});
+
+})
@@ -0,0 +1,27 @@
+<HTML>
+ <?="<head><title>Application Scope Counter Tester</title></head>"?>
+ <BODY>
+ <?
+ var counter = 1;
+ application.get("counter",function(value){
+ log.debug("COUNTER.JSSP, value - " +value);
+ if(value == undefined){
+ application.set("counter",1);
+ ?>
+ First Time;
+
+ <?}else{
+ counter = value+1;
+ application.set("counter",counter);
+ ?>
+
+ Number of users : <?=counter?>
+
+ <?}?>
+
+ </BODY>
+</HTML>
+
+
+ <?});
+ ?>
@@ -0,0 +1,3 @@
+exports.run = (function(lib,application,request,responseHead,writeEscapedText,forward,sendRedirect,write,session) {writeEscapedText("ERROR%3A%0A");
+writeEscapedText(""); write(;
+})
@@ -0,0 +1,2 @@
+ERROR:
+<? write(; ?>
Binary file not shown.
@@ -0,0 +1,3 @@
+<?
+ forward("hello.jssp");
+?>
@@ -0,0 +1,38 @@
+(function(log,lib,application,request,responseHead,writeEscapedText,forward,sendRedirect,write,session) {writeEscapedText("%3CHTML%3E%0A");
+writeEscapedText("%09%09");write("<head><title>nodeJS and antiNode+</title></head>");
+writeEscapedText("%09%3CBODY%3E%0A");
+writeEscapedText("%09%09");
+ var counter = 1;
+ application.get("counter",function(value){
+ log.debug("HELLO.JSSP, value - " +value);
+ if(value == undefined)
+ application.set("counter",1);
+ else{
+ counter = value+1;
+ application.set("counter",counter);
+ }
+ });
+
+writeEscapedText("%09%09HELLO%20WORLD%3Cbr/%3E%0A");
+writeEscapedText("%09%09Number%20of%20users%3A%0A");
+writeEscapedText("%09%09");
+ write(counter+"<br/>");
+
+writeEscapedText("%09%09%09%3Cbr/%3Erequest.parameters.night%3A%20");write(request.parameters.night);writeEscapedText("%3C/br%3E%0A");
+writeEscapedText("%09%09"); if(request.parameters.night != undefined && request.parameters.night=="1"){
+
+writeEscapedText("%09%09Good%20night%21%20%0A");
+writeEscapedText("%09%09");}else{
+writeEscapedText("%09%09Good%20Day%21%0A");
+writeEscapedText("%09%09");}
+writeEscapedText("%09%09%3Cbr/%3E%0A");
+writeEscapedText("%09%09");for (index=0;index<5;index++){ write(index);writeEscapedText("%3B"); }
+writeEscapedText("%09%09%3Cbr/%3E%0A");
+writeEscapedText("%09%09Testing%20the%20lib%3A%09%09%3Cbr/%3E%0A");
+writeEscapedText("%09%09Request%20headers%3A%20");write(lib.test.arrayToString(request.headers));writeEscapedText("%3C/br%3E%0A");
+writeEscapedText("%09%09%3Cbr/%3E%0A");
+writeEscapedText("%09%09Setting%20a%20cookie%20a%3Db%20using%3A%20responseHead.headers%5B%22Set-cookie%22%5D%20%3D%20%22a%3Db%22%3B%3Cbr/%3E%0A");
+writeEscapedText("%09%09");responseHead.headers["Set-cookie"] = "a=b";
+writeEscapedText("%09%3C/BODY%3E%0A");
+writeEscapedText("%3C/HTML%3E%0A");
+})
Oops, something went wrong.

0 comments on commit 2151b43

Please sign in to comment.