Shaft App Server 0.3
NEW!
For ALL platforms (with JAVA OR Dart support)
Download
Server: http://sourceforge.net/projects/shaftserver/files/shaftserver.zip/download
JAVA Source: http://sourceforge.net/projects/shaftserver/files/source-java.zip/download
Dart Source: http://sourceforge.net/projects/shaftserver/files/source-dart.zip/download
Install
cd to /usr directory(in windows you may need to create C:\usr)
unzip shaftserver contents to directory
cd /usr
unzip -q -o -a shaftserver.zip
Configure
*** JAVA JDK PATH MUST BE SET (if running Shaft JAVA or compiling with dartc) ***.
Requires JAVA JDK 1.6 or higher (please use SUN/Oracle JDK).
Edit /usr/shaft/bin/setenv.sh (C:/usr/shaft/bin/setenv.bat for
windows)
Run
Shaft JAVA
cd /usr/shaft/bin
./startup-java.sh
For Windows:
NOTE:In Windows edit the C:\usr\shaft\conf\Catalina\localhost\ROOT.xml
and replace /usr/shaft/webapps WITH C:/usr/shaft/webapps
cd C:/usr/shaft/bin
startup-java.bat
Shaft Dart (works only under Ubuntu)
cd /usr/shaft/bin
./startup-dart.sh
NOTE: it is early days yet for Shaft Dart, so please allow for certain deficiencies as in the following:
Only the GET method is implemented.
Examples:
General Client:
http://localhost:8677/clock/Clock.html
http://localhost:8677/dartcombat/dartcombat.html
http://localhost:8677/hi/hi.html
http://localhost:8677/isolate/isolate_sample.html
http://localhost:8677/spirodraw/spirodraw.html
http://localhost:8677/sunflower/sunflower.html
http://localhost:8677/samples/hello.html
http://localhost:8677/samples/hi.html
Client and REST:
http://localhost:8677/remotecombat/shaftrest/shaftusermgr/add?shaftuser.new=player1&shaftpassword.new=tiger1
http://localhost:8677/remotecombat/shaftrest/shaftusermgr/add?shaftuser.new=player2&shaftpassword.new=tiger2
http://localhost:8677/remotecombat/remotecombat.html
DART SERVER SIDE (Shaft Dart) (DartServerlets):
http://localhost:8677/samples/helloworld
http://localhost:8677/samples/db.html
Application Directory
The Dart Applications are located under
/usr/shaft/webapps (C:\usr\shaft\webapps for windows)
Deploy
The application directory tree for deploying Dart apps:
mydartapp
config
public
server
public is where the Dart application files are placed.
config is where the app.properties file goes.
server is where server objects resides, e.g. Database and DartServerlet.
Dart Apps URL:
Access to a Dart script is done like so:
e.g. mydart.dart --> mydart.dart.js
".dart.js" tells Shaft to process the request as a Dart app,
that is it checks to see if the Dart source needs to be compiled, if so
compilation is first done before rendering a response. If compilation
succeeds, Shaft creates a ".dart.js" from the .dart source.Custom App Configuration
Custom App Configuration can be done globally by editing:
/usr/shaft/webapps/WEB-INF/shaft/app.properties (Shaft JAVA) or
/usr/shaft/conf/app.properties (Shaft Dart).
Or per application by editing the application's config/app.properties
Supports Multiple Versions of Dart:
Just add your own build to the Dart repository directory
/usr/shaft/dart/
Specify the Dart version in
config/app.properties
dart.version=b12345
Compile Options:
You may also specify compile options.
To optimize compiled code:
config/app.properties
dart.compiler.dartc.optimize=true
To specify Dart build type:
config/app.properties
dart.compiler.dartc.build.type=Debug_ia32
dart.compiler.frog.build.type=Release_ia32
Specify Compiler:
And you may specify the compiler
config/app.properties
dart.compiler=dartc|frog
Troubleshoot
It is early days yet for Dart, so you may experience certain inconsistencies in
what you should expect, depending on the Dart build. This is especially the case
when using frog as the compiler. Depending on the Dart build or OS, frog may or
may not work. frog requires Python 2.6. For Redhat flavored OS, you may install
Python 2.6 like so:
cd /tmp
wget http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tgz
tar zxf Python-2.6.5.tgz
cd Python-2.6.5
./configure --prefix=/usr/python265
make
make install
Remember to set the python path in the app.properties file like so:
dart.compiler.frog.python=/usr/python265/bin/python
If you get a libcrypto error with frog, you may try the following:
cd /usr/lib
ln /lib/libcrypto.so.0.9.8e libcrypto.so.0.9.8
Community
Contact: grwongku(AT)gmail.com
Copyright (c) 2011-2012, the Shaft Project Authors.