Search code examples
gwtrequestfactory

RequestFactory service inheritance on the client in GWT 2.4


GWT 2.4 brings service inheritance on the client (issue 6234, issue 6035).

I've been waiting for this future for a long time, as it saves a lot of duplicated code on the client. I've started implementing it, but so for with mixed success.

This is my code:

public interface BaseEntityRequest<T>
{
    Request<Void> put(T entity);
    Request<List<T>> getAllOrderBy(String propertyName);
    Request<List<T>> getRangeAndFilter(int limit,int offset, QueryInfoProxy queryInfo);
}

@Service(value = EgdDao.class, locator = DaoServiceLocator.class)
public interface EgdRequest extends RequestContext, BaseEntityRequest<EgdProxy>
{
    Request<Void> exportToExcel(QueryInfoProxy queryInfo, String userName);
}

So far getAllOrderBy and getRangeAndFilter work fine, but put(T entity) does not.

I get the following error in the console:

[ERROR] Unexpected error
java.util.NoSuchElementException

and this gets returned in the receiver onFailure ServerFailure message:

Error 500 INTERNAL_SERVER_ERROR
HTTP ERROR 500
Problem accessing /gwtRequest. Reason:
INTERNAL_SERVER_ERROR

The only cause, that I can see, for the put method not to work, when the others do, is that it uses the generic parameter T. When I move the put method in the EgdRequest interface (using EgdProxy as a parameter instead of T) it starts to work, so I know my server code is fine.

Does anybody have any idea how to implement this correctly?

Thanks!


Solution

  • It's a GWT bug. See http://code.google.com/p/google-web-toolkit/issues/detail?id=6794