2

GWT 2.4 为客户端带来了服务继承(issue 6234issue 6035)。

我一直在等待这个未来很长时间,因为它在客户端上节省了很多重复的代码。我已经开始实施它,但结果喜忧参半。

这是我的代码:

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);
}

到目前为止getAllOrderBygetRangeAndFilter工作正常,但put(T entity)没有。

我在控制台中收到以下错误:

[ERROR] Unexpected error
java.util.NoSuchElementException

这会在接收器 onFailure ServerFailure 消息中返回:

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

put我可以看到,当其他方法不起作用时,唯一的原因是它使用了泛型参数 T。当我put在接口中移动方法EgdRequest(使用EgdProxy作为参数而不是 T)时,它开始工作,所以我知道我的服务器代码很好。

有人知道如何正确实施吗?

谢谢!

4

1 回答 1

5

这是一个 GWT 错误。请参阅http://code.google.com/p/google-web-toolkit/issues/detail?id=6794

于 2011-09-16T15:18:56.033 回答