1.5RC1 - Does RemoteServiceRelativePath actually work?

329 views
Skip to first unread message

adrian

unread,
Jun 27, 2008, 3:28:22 PM6/27/08
to Google Web Toolkit
According to the docs,
http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)s(google-web-toolkit-doc-1-5)t(DevGuideMakingACall),
RemoteServiceRelativePath annotation is meant to be used when creating
a client proxy so that you don't have to call setServiceEntryPoint()
on ServiceDefTarget. The example given uses it exactly like that,
i.e.

@RemoteServiceRelativePath("email")
MyEmailServiceAsync emailService = (MyEmailServiceAsync)
GWT.create(MyEmailService.class);

However, in the very next example they revert to using the old means
of proxy initialization, i.e. calling
ServiceDefTarget.setServiceEntryPoint().

I've played about with RemoteServiceRelativePath but it doesn't seem
to work as documented. It can't even be used in the way suggested by
the example. It's annotated with @Target(ElementType.TYPE) which would
mean that it can only be used on a "Class, interface (including
annotation type), or enum declaration".

Has anyone had any luck using it?

Miguel Méndez

unread,
Jul 1, 2008, 11:05:35 AM7/1/08
to Google-We...@googlegroups.com, Sumit Chandel, Eric Ayers, Scott Blum
On Fri, Jun 27, 2008 at 3:28 PM, adrian <adr...@17od.com> wrote:

According to the docs,
http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)s(google-web-toolkit-doc-1-5)t(DevGuideMakingACall),
RemoteServiceRelativePath annotation is meant to be used when creating
a client proxy so that you don't have to call setServiceEntryPoint()
on ServiceDefTarget. The example given uses it exactly like that,
i.e.

@RemoteServiceRelativePath("email")
MyEmailServiceAsync emailService = (MyEmailServiceAsync)
GWT.create(MyEmailService.class);

The documentation is wrong.  You apply the annotation to synchronous version of the RemoteService interface and not to the local variable.

--
Miguel

jarrod

unread,
Jul 1, 2008, 4:55:57 PM7/1/08
to Google Web Toolkit
Yup. Our code is split into several packages, including an API package
that defines the service contract, so our last-mile GWT code looks
like this:

@RemoteServiceRelativePath("../EventService.rpc")
public interface RpcEventService extends RemoteService, EventService {

}


We have several modules, so the servlets are done in Spring and mapped
to the folder containing all the modules... but those details aren't
necessary.

We then provide a factory to provide EventServiceAsync
implementations:

private static EventServiceAsync eventService;

public static EventServiceAsync getEventService() {
if (null == eventService) {
eventService = (EventServiceAsync) GWT
.create(EventServiceAsync.class);
}
return eventService;
}



Works like a charm!





On Jul 1, 11:05 am, "Miguel Méndez" <mmen...@google.com> wrote:
> On Fri, Jun 27, 2008 at 3:28 PM, adrian <adr...@17od.com> wrote:
>
> > According to the docs,
>
> >http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)s(goog...)
> > ,

Thad

unread,
Jul 29, 2008, 6:50:01 PM7/29/08
to Google Web Toolkit
What if my service interface has more than one method? I have dozens
of service calls which I have group into several different files for
manageability--ones handling logon/logout, ones running database
queries, ones managing remote files, etc. I don't want to have to
create a service for each individual RPC call.

On Jul 1, 11:05 am, "Miguel Méndez" <mmen...@google.com> wrote:
> On Fri, Jun 27, 2008 at 3:28 PM, adrian <adr...@17od.com> wrote:
>
> > According to the docs,
>
> >http://code.google.com/docreader/#p(google-web-toolkit-doc-1-5)s(goog...)
> > ,
Reply all
Reply to author
Forward
0 new messages