We've been using Spring4GWT to great effect in our enterprise application
for the last year. While it may not include every aspect of Spring, it
makes RPC's trivially easy. To review:
- Make a Spring Bean as you normally would for a backend service,
implementing your service interface and extending* RemoteServiceServlet*
- Annotate the service, i.e. @Service("myService")
- Annotate the service interface with the path of your servlet.
i.e. @RemoteServiceRelativePath("springGwtServices/myService")
- Make a servlet to handle your service (same path as above) in your
web.xml. i.e.
<servlet>
<servlet-name>springGwt</servlet-name>
<servlet-class>org.spring4gwt.server.SpringGwtRemoteServiceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>springGwt</servlet-name>
<url-pattern>/com.myapp.myModule/springGwtServices/*</url-pattern>
</servlet-mapping>
- Make sure your async interface (for the RPC's) implements your service
interface's methods.
- Finally, in your client side code, just call your service's methods.
i.e. MyServiceImpl.Default.getInstance().myRemoveMethod()
Most of the above steps need only be done once per module or service. If
you use the ContainerDTO design pattern for sending data to the client, you
need only change the ContainerDTO to send more or less data to the client.
If you want to add a new remote method to call, you just need to update the
service interface and add the method to the service. You never need to
write any packing/unpacking code or any XHR code.
Having done this sort of thing by hand (XHR handlers in JS,
serialization/deserialization, service MVC handling on the server in
PHP/C#/or Java/Struts), this way of doing things is far easier, and you can
unit test every bit of it easily in JUnit.
Sincerely,
Joe
On Tuesday, March 13, 2012 4:59:49 AM UTC-4, Alex Dobjanschi wrote:
>
> The framework is very elementary, and lacks one of spring's most important
> feature: ioc container.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/C_o3scvB-msJ.
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.