PDA

View Full Version : Pagination of a grid with RPC



SimOOn
11 Jun 2009, 1:42 AM
Hi,

I am facing a serialization problem with pagination in a grid using a GWT RPC service. The BasePagingLoadConfig class triggers that error on the server side :


org.gwtwidgets.server.spring.GWTRPCServiceExporter : Type 'com.extjs.gxt.ui.client.data.BasePagingLoadConfig' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer. For security purposes, this type will not be deserialized.During GWT compilation, I've got this :

Compiling module com.myprojectParametre
Scanning for additional dependencies:
...

Computing all possible rebind results for 'com.myprojectclient.service.IMyService'
Rebinding com.myprojectclient.service.parametre.IMyService
Invoking <generate-with class='com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator'/>
Generating client proxy for remote service interface 'com.myproject.client.service.parametre.IParametreService'
Analyzing 'com.myprojectclient.service.parametre.IParametreService' for serializable types
Analyzing methods:
public abstract com.extjs.gxt.ui.client.data.PagingLoadResult<com.myproject.dto.MyDTO>
getDTO(com.extjs.gxt.ui.client.data.PagingLoadConfig config, int idCategory)
Parameter: com.extjs.gxt.ui.client.data.PagingLoadConfig config
com.extjs.gxt.ui.client.data.PagingLoadConfig
Verifying instantiability
com.extjs.gxt.ui.client.data.BasePagingLoadConfig
Analyzing the fields of type 'com.extjs.gxt.ui.client.data.BaseModelData' that qualify for serialization
protected com.extjs.gxt.ui.client.data.RpcMap map
com.extjs.gxt.ui.client.data.RpcMap
Verifying instantiability
com.extjs.gxt.ui.client.data.RpcMap
Analyzing the fields of type 'com.extjs.gxt.ui.client.data.RpcMap' that qualify for serialization
private java.util.Map<java.lang.String, java.lang.String> _map
java.util.Map<java.lang.String, java.lang.String>
Verifying instantiability
com.google.gwt.i18n.client.impl.ConstantMap
Analyzing the fields of type 'com.google.gwt.i18n.client.impl.ConstantMap' that qualify for serialization
[WARN] Field 'private final com.google.gwt.i18n.client.impl.ConstantMap.OrderedConstantSet<java.lang.String> keys' will not be serialized because it is final
Compilation succeeded
...My client side code looks like this :

The service :

@RemoteServiceRelativePath("service.rpc")
public interface IMyService
extends RemoteService {

PagingLoadResult<MyDTO> getParametres(PagingLoadConfig config,
int idCategory);

}The proxy :


public class MyRpcProxy
extends RpcProxy<PagingLoadConfig, PagingLoadResult<MyDTO>> {
@Override
protected void load(final PagingLoadConfig loadConfig,
final AsyncCallback<PagingLoadResult<MyDTO>> callback) {
final IMyServiceAsync myService = ServiceLocator
.getMyService();
myService.getParametres(loadConfig, 1,callback);
}
}
The data loading :


// Returns the list store to the grid
@SuppressWarnings("unchecked")
public static ListStore<ParametreLigneCrudDTO> loadParametreCrudDataFromProxy(final MyGrid grid, final RpcProxy proxy) {
final BasePagingLoader loader = new BasePagingLoader(proxy,
new ModelReader<Object>());
final ListStore<MyDTO> data = new ListStore<MyDTO>(loader);
loader.setRemoteSort(true);
loader.load(0,PagingHelper.NUMBER_ITEMS_PER_PAGE);
grid.getPagingToolBar().bind(loader);
return data;
}
And on the server side, my code is :

public PagingLoadResult<MyDTO> getDTOs(final PagingLoadConfig config,
final int idCategory) {
final List<MyVO> parametres = this.dao.getVOs(idCategory);

final List<MyDTO> myDtos = new ArrayList<MyDTO>();

//Transform VOs to DTOs...

//Return a paging result
return new BasePagingLoadResult<MyDTO>(
parametresLigneCrudDto,config.getOffset(),40);
}My DTO is a DTO implementing ModelData.

Without pagination, I don't meet any problem to populate my grid.

Besides according to the compilation log, it seems to come from GXT code referring to GWT code.

Has anyone already met this problem ?

Is it a known issue or did I do something wrong ?

Thanks.

SimOOn
11 Jun 2009, 4:28 AM
I have found how to fix the problem by adding :
<set-property name="gwt.suppressNonStaticFinalFieldWarnings" value="true" />

to the gwt.xml file but turning off the warnings is not the best solution so if anyone has it, I would be glad to hear it.

ericlam
17 Jun 2009, 11:14 AM
I've multiple postings for this and no proper fix in any of the posting. We're getting the same thing as well. It happens sporadically all over the place. Once we restart the web server and redeploy our application, everything works fine.

This post seems to imply that if we suppress the warning everything works fine.

In our case, once we get this error, everything stops working until we restart the server.