GWT 2.4中的客户端上的RequestFactory服务继承 [英] RequestFactory service inheritance on the client in GWT 2.4
问题描述
GWT 2.4为客户端带来了服务继承(问题6234 ,问题6035 ) 。
我很久以来一直在等待这个未来,因为它在客户端上节省了大量重复的代码。我已经开始实施它,但是为了获得混合成功,这样做也是如此。
这是我的代码:
public interface BaseEntityRequest< T>
{
请求<无效>放(T实体);
请求< List< T>> getAllOrderBy(String propertyName);
请求< List< T>> getRangeAndFilter(int limit,int offset,QueryInfoProxy queryInfo);
}
@Service(value = EgdDao.class,locator = DaoServiceLocator.class)
public interface EgdRequest extends RequestContext,BaseEntityRequest< EgdProxy>
{
请求<无效> exportToExcel(QueryInfoProxy queryInfo,String userName);
}
到目前为止 getAllOrderBy
和 getRangeAndFilter
可以正常工作,但 put(T实体)
不会。
在控制台中出现以下错误:
[错误]意外的错误
java.util .NoSuchElementException
并且在接收器中返回onFailure ServerFailure消息:
错误500 INTERNAL_SERVER_ERROR
HTTP错误500
访问/ gwtRequest时出现问题。原因:
INTERNAL_SERVER_ERROR
我能看到的唯一原因是<$ c当其他人这样做时,放置方法不起作用的是它使用通用参数T.当我移动放入
方法时> EgdRequest
接口(使用 EgdProxy
作为参数而不是T)它开始工作,所以我知道我的服务器代码很好。
有没有人知道如何正确实施?
谢谢!
这是一个GWT错误。请参阅 http://code.google.com/p/ google-web-toolkit / issues / detail?id = 6794
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!
It's a GWT bug. See http://code.google.com/p/google-web-toolkit/issues/detail?id=6794
这篇关于GWT 2.4中的客户端上的RequestFactory服务继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!