RequestFactory service inheritance on the client in GWT 2.4

左心房为你撑大大i 提交于 2019-12-10 10:45:15

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/7433910/requestfactory-service-inheritance-on-the-client-in-gwt-2-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!