Integrating other frameworks into hosted mode

3 views
Skip to first unread message

Joe Cole

unread,
Jan 1, 2009, 3:03:35 AM1/1/09
to Google Web Toolkit
I have run into this problem a few times, so thought it may be worth
posting for others.
We wanted to be able to produce the html files via a framework like
freemarker, jsp, wicket etc in hosted mode. It turned out to be
trivial.

public class CustomShellServlet extends GWTShellServlet {

IRoutes routes;

@Override protected void doGet(final HttpServletRequest request,
final HttpServletResponse response) throws ServletException,
IOException {
if (routes.hasExplicitRouteFor(request.getRequestURI())) {
router.service(request, response);
return;
}
super.doGet(request, response);
}
}

All you need to do is override the requests for the html files
themselves. In my example it uses an internal class we use, but can
easily work with freemarker templates or other view technologies.

The only configuration change was replacing gwtshellservlet in the
tomcat/webapps/ROOT/WEB-INF/web.xml to:

<servlet>
<servlet-name>shell</servlet-name>
<servlet-class>com.your.packagename.CustomShellServlet</servlet-
class>
</servlet>

Sumit Chandel

unread,
Jan 7, 2009, 7:47:58 PM1/7/09
to Google-We...@googlegroups.com
Hi Joe,

Alternatively, you can use hosted mode with the -noserver option to use your own backend to produce and serve your HTML files. GWT hosted mode will still work to debug your GWT client-side code as well.

Using hosted mode with the -noserver option:
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=FAQ_HostedModeNoServer

Cheers,
-Sumit Chandel
Reply all
Reply to author
Forward
0 new messages