If you’re developing GWT apps with traditional servlets (other than GWT-RPC) with your web server running as separate process, you can’t really send GWT Ajax messages from hosted mode since the outside process and port are considered to be another domain and GWT won’t send cross domain requests. One clean solution is to use a transparent proxy as hosted mode servlet and let that proxy talk to the real server. Here are the steps I took:
Find following jars are copy them to your GWT project:
{GWT-Project}/war/WEB-INF/lib
jetty-http-7.1.3.v20100526.jar
jetty-io-7.1.3.v20100526.jar
jetty-servlets-7.1.3.v20100526.jar
jetty-continuation-7.1.3.v20100526.jar
jetty-util-7.1.3.v20100526.jar
jetty-client-7.1.3.v20100526.jar
jetty-jmx-7.1.3.v20100526.jar
Add these jars to Referenced Libraries -> Build Path -> Configure Build Path -> Libraries -> Add Jars.
Don’t forget to make sure these jars are selected in ‘Order and Export’ Tab.
Modify {GWT-Project}/war/WEB-INF/web.xml:
<web-app> <filter> <filter-name>JettyContinuationFilter</filter-name> <filter-class>org.eclipse.jetty.continuation.ContinuationFilter</filter-class> </filter> <filter-mapping> <filter-name>JettyContinuationFilter</filter-name> <url-pattern>/app/*</url-pattern> </filter-mapping> <servlet> <servlet-name>jetty-proxy-servlet</servlet-name> <servlet-class>org.eclipse.jetty.servlets.ProxyServlet$Transparent</servlet-class> <init-param> <param-name>ProxyTo</param-name> <param-value>http://localhost:8080/</param-value> </init-param> <init-param> <param-name>Prefix</param-name> <param-value>/</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jetty-proxy-servlet</servlet-name> <url-pattern>/app/*</url-pattern> </servlet-mapping> </web-app>
Now all your URLS in your GWT app starting with ‘/app’ are normally forwarded to your traditional web server at localhost:8080.
BTW, I got these jetty jars from my local maven .m2 repository.

