We haven't used gwt-spring. We are using gwt-dispatch with an
implementation of their DispatchService interface and a subclass of the GWT
RemoteServiceServlet class. We have had no issues with this. Then just had
this servlet in like you would any other.
It looks like this:
public class StandardDispatchServiceServlet extends RemoteServiceServlet
implements DispatchService {
private static final long serialVersionUID = 1L;
private Dispatch dispatch;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
WebApplicationContext applicationContext =
WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext());
AutowireCapableBeanFactory beanFactory =
applicationContext.getAutowireCapableBeanFactory();
beanFactory.autowireBean(this);
}
public Result execute(Action<?> action) throws ActionException {
try {
HttpServletRequest request = getThreadLocalRequest();
BaseDispatchCommand cmd = (BaseDispatchCommand)action;
cmd.setHost(request.getLocalAddr());
cmd.setPort(request.getLocalPort() + "");
cmd.setUrlContext(request.getContextPath());
if(cmd.isSerializationRequired()){
//only allow 1 synchronized required request to execute at a time
//requires a session to have already been generated
synchronized(request.getSession(true).getId().intern()){
return dispatch.execute(action);
}
} else {
return dispatch.execute(action);
}
} catch (RuntimeException e) {
log("Exception while executing " + action.getClass().getName() +
": " + e.getMessage(), e);
throw e;
}
}
@Autowired
@Required
public void setDispatch(Dispatch dispatch) {
this.dispatch = dispatch;
}
}
Hopefully this is an option for you.
Jas
On Wed, Sep 8, 2010 at 4:36 AM, Deepak Singh <[email protected]>wrote:
> I also downloaded SimpleGwtRpcSpringExample an dimported this into my
> eclipse 3.5 with jdk 1.6 but i could not run it.
> I got the exception
>
> com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This
> application is out of date, please click the refresh button on your browser.
> ( Expecting version 5 from client, got 6.
> I also tried to configure them seperately into my project but got the same
> error.
>
> Any one who has done this gwt-spring integration, can u pls help on that.
>
> My need is to call web services method from spring and the get the result
> back to client code.
> Any other solution to integrate them if anyone is using.
>
>
>
>
> On Fri, Sep 3, 2010 at 7:30 PM, markM <[email protected]> wrote:
>
>> Sam/George,
>>
>> Just started looking into this same thing about a month ago. My
>> experience was as follows. I found that the Spring documentation
>> references the GWT Server Library so it must be the official pathway
>> correct? I tried to use the inheritance methodology, one of three the
>> GWT Server Library supports, and got it working temporarily under
>> Jetty/GWT Eclipse plugin. For some reason it stopped working. Then I
>> read further in the GWT Server Library documentation and found that
>> the authors tell you simply not to use the GWT plugin's built in web-
>> server (Jetty). In other words you have to work with the -noserver
>> option in GWT in order to debug server side code because Jetty doesn't
>> support J2EE features that Spring uses that for instance Tomcat or
>> other web servers support. I had used -noserver previously and so
>> thought this not to be a big deal. However, with a fair amount of
>> effort I never got the project to run even in -noserver mode. My
>> experience with the GWT Server Library documentation and I believe
>> they even stated this in the documentation was that you're expected to
>> already understand Spring and this made it more difficult for me to
>> implmenet. Moving to -noserver mode also required me to muck with
>> eclipse setting files in order to make my GWT eclipse project also a
>> Web-Eclipse project. Probably with more time I would have been able
>> to figure it out but it wasn't clean having to muck with eclipse files
>> anyway and I was looking for the simplest methodology as I'm trying to
>> get folks within my company to understand the beauty of GWT and
>> roadblocks like this don't help.
>>
>> Yesterday, after reading your post I downloaded the
>> SimpleGwtRpcSpringExample.zip file from the URL Sam mentioned
>>
>> http://code.google.com/p/gwtrpc-spring/
>>
>> The self-containing Eclipse project worked out of the box! under
>> Jetty! I did have to move to JDK 1.6 and recompile to get rid of a
>> class versioning error. I notice that the bright folks who wrote this
>> component created their own dispatcher class so as to not have to use
>> Spring's dispatcher class. I'm assuming that this is the reason that
>> it worked under Jetty because their custom dispatcher doesn't rely on
>> the extra J2EE facilities that Spring's dispatcher does. There may be
>> downsides to this component but I haven't seen any yet. One thing I
>> read about the GWT Server Library is that if you use their inheritance
>> scheme to spring enable your server side rpc class it's faster because
>> it doesn't use reflection. However, if all you're doing is making
>> calls into the server based upon button clicks the vast majority of
>> your processing is going to likely go in in the server and so the
>> performance thing may be of little consequence. I don't see a pause
>> in the example greet server app when I click the button. If anyone
>> has used the gwtrpc-spring component extensively and knows more about
>> the downsides, if any, I'd love to hear about it.
>>
>>
>> On Sep 3, 3:12 am, Alek <[email protected]> wrote:
>> > Hi,
>> >
>> > We also use SL for our project. I configured this solution once and
>> > forgot about it.
>> >
>> > Respect
>> >
>> > On Aug 31, 11:24 pm, George Georgovassilis<[email protected]>
>> wrote:
>> > > Hi Sam,
>> >
>> > > The SL [1] is a community maintained integration of Spring and GWT
>> > > mainly focused at exporting Spring managed beans as RPC services. It
>> > > was launched four years ago and has reached through many releases a
>> > > high degree of maturity. The documentation is extensive, it's easy to
>> > > use (though I'm biased) but it's been criticized for not using maven.
>> >
>> > > [1]http://gwt-widget.sourceforge.net/
>> >
>> > > On Aug 31, 5:31 pm, Sam <[email protected]> wrote:
>> >
>> > > > Note: this thread is about using Spring for your service impls in a
>> > > > GWT app (it's not about integrating Spring MVC or using ROO. It's
>> also
>> > > > not about Guice)
>> >
>> > > > There are a few posts on this but it's hard to tell what the best
>> > > > method is today. The two contenders seem to me to be:
>> >
>> > > > 1)http://code.google.com/p/gwt-spring-starter-app/(myprojectbased
>> > > > on P.G. Taboada's approach:
>> http://pgt.de/2009/07/17/non-invasive-gwt-and-spring-integration-relo...)
>> >
>> > > > which is as simple as can be, however, the one annoyance is that you
>> > > > need yet another class for each RPC Service (A wrapper that extends
>> a
>> > > > spring context injecting RemoteServiceServlet)
>> >
>> > > > 2)http://code.google.com/p/gwtrpc-spring/
>> >
>> > > > Just glanced at this. Looks a lot more complicated and the project
>> > > > has a lot of unresolved issues.
>> >
>> > > > Am I missing any approaches? Surely you other GWT devs are using
>> > > > Spring on the back end if you're writing serious applications.
>> Don't
>> > > > be shy, please speak up.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-web-toolkit%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.