Can't use hosted mode to debug anything if it involved asynch stuff
since it fails the security part.
I'm not sure whether the browsers will let you do an async call on a
different port, and it might vary from browser to browser.
Here's something you can try, though:
- Copy your html file, gwt.js, and gwt-hosted.html (*) over to the
other server, and have them served from the same path that hosted mode
would have served them from.
- Launch the shell as normal and let the app load on port 8888
- Change the address bar to use the other port and click the green
arrow
* gwt.js and gwt-hosted.html are in gwt-user.jar at
com/google/gwt/core/public
Does this work for you?
Scott
You can point the browser to another location on localhost, but then
you leave the Java compiled version of your app so you loose debugging
anyways.
It would be nice if there was an option for the Hosted mode browser to
"bypass" the security restrictions on async calls, it would make it a
lot more valuable.
I just went through the process with the JSON example on Windows.
Here's the step-by-step I used:
Downloaded Jetty
(http://prdownloads.sourceforge.net/jetty/jetty-5.1.11RC0.zip). Copied
Jetty's org.mortbay.jetty.jar, commons-logging.jar, and
javax.servlet.jar into C:\sandbox\temp.
Copied contents of samples\JSON\www\com.google.gwt.sample.json.JSON
into C:\sandbox\temp\com.google.gwt.sample.json.JSON. Editted the
first string in search-results.js from "ResultSet" to "BlahSet".
Copied gwt-hosted.html into
C:\sandbox\temp\com.google.gwt.sample.json.JSON
C:\sandbox\temp>java -cp
org.mortbay.jetty.jar;commons-logging.jar;javax.servlet.jar
org.mortbay.http.HttpServer 1888
Launched IE and ran
http://localhost:1888/com.google.gwt.sample.json.JSON/JSON.html in web
mode, to verify that it was working and "BlahSet" showed up.
Went into samples\JSON directory and ran
..\..\projectCreator.cmd -eclipse JSON
..\..\applicationCreator.cmd -ignore -eclipse JSON
com.google.gwt.sample.json.client.JSON
Imported the JSON project into Eclipse, ran the JSON launch config
successfully (port 8888), clicked Search. Response shows "ResultSet".
Changed the port in my hosted browser window to 1888, hit enter,
clicked Search. Response shows "BlahSet".
Put a breakpoint on JSON.java line 67.
Clicked "Search" again.
Breakpoint, responseText shows "BlahSet".
Scott
i want to download specific number of bytes(calculated from frontend)
from a file hosted on the webserver .
Downloading is to be done from two different ports and then i have to
show the time taken for both of them
We were using applet earlier for this.
Please guide me how to do the same thing with GWT.
How can we open httpconnections from it and download files?
Please help.
We are using a package called HttpUnit to call another servlet from our
RemoteServiceServlet. The trick here is to make the HttpUnit call(s) on
the server side, since you won't be able to call servers on other ports
from the browser (for security reasons). The scope for HttpUnit is
testing (of web applications) and since it is used in a different
purpose here, I guess you have to do some extending testing of
performance before rolling it out in a "busy" environment. There are
some short code samples on the HttpUnit site:
http://httpunit.sourceforge.net/ for calling an HTTP server from within
Java code (using the WebConversation class).
Hope this at least gives you an idea how this can be done. Cheers Björn
I just did this using a simple proxy class - I posted the source back
to this list.
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/87d48880dbd26472
Basically put the proxy so it gets loaded by your gwt app in the hosted
bit and point it at your real server. The GWT client is happy because
its talking to the right host/port and you're also talking to the right
back-end.
Dave