PDA

View Full Version : Paging Grid - Paging Tool Bar issue



extjs@intelliware.ca
26 Jan 2010, 2:06 PM
Hi,

I'm trying to implement a Paging Grid with a remote store (on Tomcat). To get the base data, the service classes in Tomcat make a call to JBoss. I've been unable to resolve the following stack trace on hosted mode and IE/ FF as well -


2010-01-26 11:54:36,634 ERROR [btpool0-0] controller.GwtRpcController - com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: 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.
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: 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.
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:298)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:164)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:121)
at ca.companyname.gwt.controller.GwtRpcController.processCall(GwtRpcController.java:47)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
at ca.companyname.gwt.controller.GwtRpcController.handleRequest(GwtRpcController.java:39)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: com.google.gwt.user.client.rpc.SerializationException: 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.
at com.google.gwt.user.server.rpc.impl.LegacySerializationPolicy.validateDeserialize(LegacySerializationPolicy.java:123)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:490)
at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:61)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:131)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:372)
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:287)
... 43 morethe client code is -


public class FeedComponent extends ContentPanel {

private IPdcSite entryPoint;
private ListStore<BeanModel> store;
PagingLoader<PagingLoadResult<ModelData>> loader;
Grid<BeanModel> feedGrid;
BeanGrid<FeedItemVO> feedBeanGrid;

public FeedComponent(IPdcSite entryPoint) {
super();
this.entryPoint = entryPoint;
}

@Override
protected void onRender(Element parent, int index) {
createUI();
super.onRender(parent, index);
}

private void createUI() {
loader = getFeedDataPagingLoader();
store = new ListStore<BeanModel>(loader);

final PagingToolBar toolBar = new PagingToolBar(5);
toolBar.bind(loader);

List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig feedItem = new ColumnConfig("userName", 100);
feedItem.setRenderer(new GridCellRenderer<ModelData>() {

@Override
public Object render(ModelData model, String property,
ColumnData config, int rowIndex, int colIndex,
ListStore<ModelData> store, Grid<ModelData> grid) {
return ""+ model.get("userName") + model.get("text") + model.get("createdDate");
}

});

columns.add(feedItem);
ColumnModel columnModel = new ColumnModel(columns);

feedGrid = new Grid<BeanModel>(store, columnModel);
feedGrid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>() {

@Override
public void handleEvent(GridEvent<BeanModel> be) {
loader.load(0, 4);
}
});

BufferView bufferView = new BufferView();
bufferView.setRowHeight(56);
feedGrid.setHideHeaders(true);
feedGrid.setTrackMouseOver(false);
feedGrid.setStripeRows(true);
feedGrid.setBorders(false);
feedGrid.setAutoExpandColumn("userName");
feedGrid.setView(bufferView);

ContentPanel panel = new ContentPanel();
panel.setFrame(false);
panel.setCollapsible(false);
panel.setAnimCollapse(false);
panel.setHeaderVisible(false);
panel.setLayout(new FitLayout());
panel.add(feedGrid);
panel.setSize(598, 325);
panel.setBottomComponent(toolBar);
panel.setBodyBorder(false);

add(panel);
}

private RpcProxy<PagingLoadResult<FeedItemVO>> getFeedDataProxy() {
RpcProxy<PagingLoadResult<FeedItemVO>> proxy = new RpcProxy<PagingLoadResult<FeedItemVO>>() {
@Override
public void load(Object loadConfig, AsyncCallback<PagingLoadResult<FeedItemVO>> callback) {
getService().getFeedItemsForCurrentUser( (PagingLoadConfig) loadConfig, callback);

}
};

return proxy;
}


private PagingLoader<PagingLoadResult<ModelData>> getFeedDataPagingLoader() {
final PagingLoader<PagingLoadResult<ModelData>> loader = new BasePagingLoader<PagingLoadResult<ModelData>>(
getFeedDataProxy(), new BeanModelReader());

loader.setSortDir(SortDir.DESC);
loader.setRemoteSort(true);

return loader;
}

private ISiteGwtServiceAsync getService() {
return this.entryPoint.getService();
}

}




The service method in Tomcat is -


@Override
public PagingLoadResult<FeedItemVO> getFeedItemsForCurrentUser(PagingLoadConfig pagingLoadConfig) {

List<FeedItemVO> feedItemVOList = getJBossService().getFeedItemsForCurrentUser();

int start = pagingLoadConfig.getOffset();
int limit = feedItemVOList.size();

ArrayList<FeedItemVO> subFeedItemVOList = new ArrayList<FeedItemVO>();

if (pagingLoadConfig.getLimit() > 0) {
limit = Math.min(start + pagingLoadConfig.getLimit(), limit);
}
for (int i = pagingLoadConfig.getOffset(); i < limit; i++) {
subFeedItemVOList.add(feedItemVOList.get(i));
}

return new BasePagingLoadResult<FeedItemVO>(subFeedItemVOList, pagingLoadConfig.getOffset(), feedItemVOList.size());

}I've searched the forums, but the solutions posted (i.e.serialization policy file cache issues) didn't resolve this error.

I was wondering if anyone had a better solution to this issue?
If I change the service method in Tomcat to return List<FeedItemVO>, I am able to get a list of feedItemVOs and display it in the grid. However, I need to implement the paging and by following the paging example in the showcase, I've been unsucessful.

Also, the FeedItemVO class implements the Serializable and IsSerializable interfaces.

Any help would be much appreciated.

Thanks!

extjs@intelliware.ca
28 Jan 2010, 9:07 AM
Managed to get a solution to this problem.
The change was in 'processCall' method of the GwtRpcController from this -


public String processCall(String payload) throws SerializationException {
try {

RPCRequest rpcRequest = RPC.decodeRequest(payload);
to


public String processCall(String payload) throws SerializationException {
try {

RPCRequest rpcRequest = RPC.decodeRequest(payload, IMyServiceInterface.class, this);A similar solution was posted earlier in another thread, but I thought I'd post the solution here as well.

To the Ext team, you guys have done a great job with the examples, but it would be good to see some documentation around the examples as well.