GWT 2.4在客户端上提供服务继承(问题6234,问题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);
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,getAllOrderBy与getRangeAndFilter做工精细,但put(T entity)没有.
我在控制台中收到以下错误:
[ERROR] Unexpected error
java.util.NoSuchElementException
Run Code Online (Sandbox Code Playgroud)
这将在接收器onFailure ServerFailure消息中返回:
Error 500 INTERNAL_SERVER_ERROR
HTTP ERROR 500
Problem accessing /gwtRequest. Reason:
INTERNAL_SERVER_ERROR
Run Code Online (Sandbox Code Playgroud)
我可以看到,唯一的原因是put,当其他方法不工作时,它使用通用参数T.当我put在EgdRequest界面中移动方法(使用EgdProxy作为参数而不是T)时,它开始工作,所以我知道我的服务器代码很好.
有没有人知道如何正确实现这一点? …