PK >N N build.xml
PK >e) READMEGWT2 Plugin for Play!
by Vincent Buzzano
Current version is 1.6 for play 1.2
Project Webstie: http://github.com/vbuzzano/play-gwt2
This module has been tested with gwt 2.2.0.
QUICK START
-------------------------------------
First of all, set the path of your gwt home
> export $GWT_HOME=
Edit /conf/dependencies.yml files, and add gwt2 module:
~# Application dependencies
~require:
~ - play
~ - play -> gwt2 1.6
Skip the next command if you want to install the module directly in the "modules" folder of your application. Otherwise the module will be installed in play! framework.
> play install gwt2
To add gwt2 module to your application, play dependencies management
> play deps
Then init your porject with:
> play gwt2:init
During initialisation, gwt2 module will copy gwt-user.jar in your application lib folder.
if you want, you can remove it and add gwt-user to your conf/dependencies.yml
~# Application dependencies
~require:
~ - play
~ - play -> gwt2 1.6
~ - com.google -> gwt-user 2.2.0
then run "play deps" again
After init create you first gwt module:
> play gwt2:create
And test it:
> play gwt2:devmode
PLAY SHELL COMMANDS:
--------------------------------------
For alist of commands, execute
> play gwt2:help
This will display GWT2 Plugin for Play! commands help.
HISTORY
--------------------------------------
1.6 ASync improvement
- Add GWT2SercieAsync annotation to define if a GWT2Service need to be invoked asyncron as aJob
- Add GWT2Chain concept to enable no async service to run Promise/Future/Job async with a callback
With this you can start as many future as you want without blocking the service thread
- Add new Async Sample
- Improve errors handling
- some bug fixes
1.5 Big Update
- update documentation
- fix 500 error problem with 1.2 and new application
- change route loading and invoker
- Improve gwt Service invokation with async call.
- redefine configuration fields (gwt.publicdir, gwt.publicpath, gwt.modulesdir)
- improve devmode (take care about publicpath) and add main application path
- New Service system. No more need for annotation GWT2ServicePath. Just add a new service name your service
as the @RemoteServiceRelativePath value but with Capitalization in
1.4 Upgrade plugin for play! 1.2
- update documentation
- bug fix
1.3 Upgrade plugin for play! 1.1
- Improved command line system
- Add Play Model support Documentation
- Add samples
- Add GWT Modules path to Play Configuration
- Fix lot of bugs
1.2 Improve documentation and commands shell.
- Rewrite command.py
- Add compilation command
- Add clean command
- Improve devmode launch
- Change Plugin Class name for compatibility with 1st GwT Plugin
1.1 first offical released. Bug fixed.
1.0 first buggy released based on play-gwt by Rustem Suniev
PK >+j j build.properties# Ant properties for building the play-gwt2
play.path=../../bin/play/play
gwt.path=../../../GWT/gwt-2.1.1
PK Lj>Yli" " manifestversion=1.6
frameworkVersions=1.2
PK h> commands.py###############################################################################
# GWT2 Plugin for Play! 1.1
# by Vincent Buzzano
###############################################################################
import getopt, sys, os, inspect
global gwt2_module_dir, command_dir
gwt2_module_dir = inspect.getfile(inspect.currentframe()).replace("commands.py","")
command_dir = os.path.join(gwt2_module_dir, "pym", "gwt2", "commands")
sys.path.append(os.path.join(gwt2_module_dir, "pym"))
from gwt2 import *
from gwt2.commands import *
from play.utils import *
###############################################################################
# Call a module command
###############################################################################
def callModuleCommand(args):
global command_dir
module = None
command = args.get("command")
for file in os.listdir(command_dir):
if file[-3:] == '.py' and file[0:2] != '__':
m = file[0:-3]+".getCommands()"
cmd = eval(m)
for item in cmd :
if item == command :
module = file[0:-3]
if command != "" and module != None:
eval(module+'.execute(args)')
###############################################################################
# Module Execute
###############################################################################
def execute(**kargs):
global args
args = kargs
# get application
app = kargs.get("app")
# get env
env = kargs.get("env")
# get args
play_remaining_args = kargs.get("args")
# gwt plublic path
kargs['public_path'] = app.readConf('gwt2.publicpath')
if kargs['public_path'] == None or kargs['public_path'] == '':
kargs['public_path'] = '/app'
# gwt plublic dir
kargs['public_dir'] = app.readConf('gwt2.publicdir')
if kargs['public_dir'] == None or kargs['public_dir'] == '':
kargs['public_dir'] = 'gwt-public'
# get modules dir
modules_dir = app.readConf('gwt2.modulesdir')
if modules_dir == "":
modules_dir = 'gwt'
kargs['modules_base_classpath'] = modules_dir.replace(os.sep,".") + "."
kargs['modules_dir'] = os.path.join('app', modules_dir)
# Module path (this_path)
kargs['gwt2_module_dir'] = gwt2_module_dir
# Check options
gwt_path = None
try:
optlist, args = getopt.getopt(play_remaining_args, '', ['gwt='])
for o, a in optlist:
if o == '--gwt':
gwt_path = os.path.normpath(os.path.abspath(a))
except getopt.GetoptError, err:
print "~ %s" % str(err)
print "~ "
sys.exit(-1)
# if path has not been set via arguments, we check for OS variable
if not gwt_path and os.environ.has_key('GWT_PATH'):
gwt_path = os.path.normpath(os.path.abspath(os.environ['GWT_PATH']))
if not gwt_path and os.environ.has_key('GWT_HOME'):
gwt_path = os.path.normpath(os.path.abspath(os.environ['GWT_HOME']))
# if nothing has been found. stop
if not gwt_path:
print "~ Error: You need to specify the path of you GWT installation, "
print "~ either using the $GWT_PATH or $GWT_HOME environment variable or with the --gwt option"
print "~ "
sys.exit(-1)
# check for minimum library
if not os.path.exists(os.path.join(gwt_path, 'gwt-user.jar')) or not os.path.exists(os.path.join(gwt_path, 'gwt-dev.jar')):
print "~ Error: %s is not a valid GWT installation (checked for gwt-user.jar and gwt-dev.jar)" % gwt_path
print "~ This module has been tested with GWT 2.0.3"
print "~ "
sys.exit(-1)
kargs['gwt_path'] = gwt_path
# execute command
callModuleCommand(kargs)
###############################################################################
# Init Modules Commands
###############################################################################
###############################################################################
# Get Dynamic commands and Help List
###############################################################################
# commands list
clist = []
hlist = {}
#clist.append('eclipsify')
for file in os.listdir(command_dir):
if file[-3:] == '.py' and file[0:2] != '__':
m = file[0:-3]+".getCommands()"
cmd = eval(m)
for item in cmd :
# append command
clist.append(item)
# create command help
h = file[0:-3]+".getHelp()"
try:
h = eval(h)
except:
h = "No help found"
hlist[item] = h
COMMANDS = clist
HELP = hlist
PK h>ӖbI! ! bin/play.plugins1000:play.modules.gwt2.GWT2PluginPK h>3I@}: : bin/views/tags/gwt2/module.html*{
* insert a script tag in the template to load a gwt2 module.
* by convention, referred script must be put under the path defined in the conf file with
gwt2.publicpath
* module (required) : module name
* id (opt.) : sets script id attribute
* charset (opt.) : sets source encoding - defaults to UTF-8
*
* #{gwt2.module id:'mymodule' , module:'mymodule', charset:'utf-8' /}
}*
%{
(_arg ) && (_module = _arg);
if (!_module) {
throw new play.exceptions.TagInternalException("module attribute cannot be empty for gwt2.module tag");
}
_module = "/" + play.modules.gwt2.GWT2Plugin.publicDir() + "/" + _module + "/" + _module + ".nocache.js"
try {
_abs = play.mvc.Router.reverseWithCheck(_src, play.Play.getVirtualFile(_module), false);
} catch (Exception ex) {
throw new play.exceptions.TagInternalException("File not found: " + _module);
}
}%
PK q>Q ' bin/play/modules/gwt2/GWT2Invoker.class 2 play/modules/gwt2/GWT2Invoker
play/jobs/Job service Lplay/modules/gwt2/GWT2Service; request Lplay/mvc/Http$Request; response Lplay/mvc/Http$Response; session Lplay/mvc/Scope$Session; body Ljava/lang/String; result Ljava/lang/Object; responseload
rpcRequest +Lcom/google/gwt/user/server/rpc/RPCRequest; (Lplay/modules/gwt2/GWT2Service;Lplay/mvc/Http$Request;Lplay/mvc/Http$Response;Lplay/mvc/Scope$Session;Lcom/google/gwt/user/server/rpc/RPCRequest;)V Code
()V !
# % ' & play/mvc/Http$Request
( Ljava/io/InputStream;
* , + play/libs/IO - . readContentAsString )(Ljava/io/InputStream;)Ljava/lang/String; 0
LineNumberTable LocalVariableTable this Lplay/modules/gwt2/GWT2Invoker; doJobWithResult ()Ljava/lang/String;
Exceptions 9 java/lang/Exception
; <