Friday, August 31, 2018

Re: How to write RPC services that don't inherit RemoteService?

I figured there wasn't something ready for this out of the box but if the effort isn't so big I'd considered implementing.

I think there should be a way to avoid extending RemoteInterface, which pollutes pure Java code. I think where would be benefits with or without Spring. GWT.create() is on the client side, right? Why does the original interface matter if it uses the async version?

There's a verification in the method RPC.decodeRequest (GWT 2.7) which I think serves only to avoid a client making a request to a random not RPC-exposed service at the server. It checks if the class "isAssignableFrom" RemoteService.class. I believe this verification could be changed to a method like "is registered as an RPC service" and given some flexibility over what to expose (not only classes implementing RemoteService interface).

I'll probably write my own code for this but I feel this is something desirable to the community because it keeps the original interface untouched.

Douglas

Em sex, 31 de ago de 2018 às 12:07, Thomas Broyer <t.broyer@gmail.com> escreveu:
Your interfaces need to extend RemoteService, otherwise the GWT.create() will fail; so I don't think what you're trying to do would be possible…

It might be possible to create those proxies programmatically though using java.lang.reflect.Proxy, binding everything together through reflection and Spring BeanFactory/ApplicationContext, and even generating the GWT interfaces automatically from the non-GWT ones (public interface ExampleService implements ExampleServiceStub, RemoteService {})
You'd have to somehow dig into RPC "internals" though, to replace the RemoteServiceServlet behavior to load your beans (there used to be a project named spring4gwt that did this years ago)

(disclaimer: I'm not a Spring user –I don't like Spring–, so I can't help further)

On Friday, August 31, 2018 at 3:13:56 PM UTC+2, Douglas de Oliveira Mendes wrote:
Hi,

I have a bunch of service interfaces in a jar. They don't extend RemoteService interface. Their server side implementations are currently spring remoting stubs (HttpInvokerProxyFactoryBean).

[browser side] <---RPC---> [server side] <---Spring remoting (http invoker)---> [actual service implementations with business rules and all]

I wish to use these interfaces (or their async versions) client side on GWT enabling compile time verifications. Currently I have dumb server side implementations that delegate all the calls. Like this:

public class ExampleServiceImpl implements ExampleService {
@Resource
private ExampleServiceStub exampleServiceStub;
int doSomething() {
 
return exampleServiceStub.doSomething();
}


I would like to get rid of the above class. Ideas? Something better than overriding RPC.decodeRequest method? Maybe it's something that has already been done...

Thanks!
Douglas

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment