GWT noserver mode

I was wondering if anyone can tell me how to set up a more complex GWT project.

It seems inevitable that any decent sized GWT project will end up requiring the -noserver mode of the hosted browser. I for one would like to integrate the GWT-SL project to get spring support.

It seems that in the eclipse world the best option is to have to separate projects, one for the client and one for the servlets (the rpc backend).

This makes a great deal of sense because the components have different lifecycles if you split them to different servers. I assume in IntelliJ the 'projects' would be different modules, and the servlet module would have the settings required to package it and send it to another appserver via normal configurations (i've not used IntelliJ before this project so I'm not sure of the normal way to do j2ee work in it - I am an eclipse refuge :)

However, I don't see how it is possible to set up IntelliJ to use a separate module for the back end servlet. It would take more than just passing the -noserver option to the gwt shell, there would have to be something to take into account of the IntelliJ inspections that match the service interfaces to the implementations and the other advanced IntelliJ functions.

I wonder if there is another way? Such as just making a normal servlet module and putting the GWT stuff in there, and ignoring any errors, or even using another 'normal' servlet and having the GWT servlet talk to it somehow?

In any case, I am reluctant to start ripping apart my project without a clearer idea of how to proceed.


Comment actions Permalink

Hi Nos,

I was wondering about this as well and do not see a clear answer.
In IDEA 8 there is a possibility to specify a custom web.xml , so in theory it should be possible to use gwt-sl together with hosted mode, but unfortunately there is a problem with serialization - seems that in the hosted mode you have to use the default gwt servlet, because it is aware of the location of the serialization files. I was not able to think of any solution to this problem.

So I am also interested in the "best practices" in setting up the environment in the -noserver mode.

Comment actions Permalink

I will mention how I have proceeded for others who find this post while searching for a solution to the same problem.

The main goal I was trying to achieve is the integration of Spring and Hibernate.

I have now proceeded by using the RemoteServlet as more of a gateway to a collection of service classes which are Spring managed. As per some code I found in the Hibernate4GWT project (Bruno Marchesson) , I now wrap Springs applicationContext in a utility class, then use that to retrieve the instances of the services (such as LoginService, UserService, OrdersService, etc) in the init of the RemoteServlet.

Done this way, the Spring/Hibernate combo works fine in the hosted browser. It seems to me that there is little benefit to extending the reach of Spring to the GWT RemoteServlet, and that the real impetus for doing so is more pronounced with more "web" frameworks like SpringMCV where there are many servlets to provide the functionality of the application, rather then one (or a couple) of monolithic ones.

I don't have a problem with passing hibernates so-called 'pojo's' off to the view, which may or may not require a more complex setup, as I use the technique of 'slicing' the entity graph and building DTO's to pass to the view with their own view-centric functions like merging and highlighting stale data.

It would still be nice if IntelliJ could develop against a no-server hosted browser, and I think this should be a priority for the GWT module in IDEA8.



Please sign in to leave a comment.