this is the proof-of-hack I've done to work with both GWT and Web2py. Works 
across Development and Production modes.

To get the Web2py server URL to make requests to the server I use this code 
in my GWT client app:

String server_url;
if (GWT.isProdMode()) {
    server_url = GWT.getHostPageBaseURL().replace("GWTAPPNAME", 
"WEB2PY_APPNAME") + query;
} else {
    server_url = GWT.getHostPageBaseURL() + "init/" + query;
    server_url = server_url.replace(":8888", ":8000");
}

WEB2PY_APPNAME is "welcome", "init" or whatever you've named your server 
application in Web2py's application directory.
GWT_APPNAME is the name of your GWT project.

Simply add "default/YOU_FUNC" to server_url and use in RequestBuilder 
builder = new RequestBuilder(RequestBuilder.GET, URL.encode(server_url)); 
calls.

In development mode GWT and Web2py (obviously) use different ports but can 
be set-up to use the same IP address (e.g., they both default to 127.0.0.1).
So, in dev mode, we replace port 8888 with 8000.

Finally, one needs to run a web browser with security turned off to our 
JScript code to call another server. This is crazy but I've not found an 
alternative approach. Launch Chrome with -disable-web-security on the 
cmdline will achieve this.

That's it. The remainder of the code can be mode agnostic. Publishing this 
to solicit better set-ups that use GWT and Web2py.



On Saturday, 9 June 2012 23:39:24 UTC+1, howesc wrote:
>
> ok, then can you use your webserver to handle the static file handling 
> rather than web2py?  that sounds like your best bet given your 
> restrictions. 
>
> cfh 
>
> On 6/9/12 15:20 , Carl wrote: 
> > It'd be nice that it wouldn't matter but tech often like that. Web2py 
> treats files differently based upon location (see e manual's section on 
> Web2py's static directory). 
> > 
> > GWT sees its root and all files "below" and nothing "above". 
> > 
> > And if I stick a GWT HTML file outside of static then Web2py doesn't 
> allow static access to it. 
> > 
> > 
>

Reply via email to