Hello Ben, that's very surprising. I personnally work on a GWT project for a customer. We handle quite big objects and the GWT serialisation/deserialisation is not a problem. In order to see what happens, did you try with a classic HTTP client, such as curl, or a clientResource (from the jse edition)? This should validate that the serialisation on server side is the problem or not.
Then, I notice a difference between the code used for testing json and gwt. The "json" one simply displays the entity body (no deserialisation) whereas the one for gwt implies deserialisation and update of the DOM tree. This could make a big difference, especially if you are using Internet Explorer (release 6, 7 or 8), because this broswer is particularly slow when handling javascript code and updating the DOM tree. You can try this google plugin called "chrome frame" => http://code.google.com/intl/fr/chrome/chromeframe/. Best regards, Thierry Boileau Hello, > > I encounter problem of performance in the serialization of an object by > restlet-gwt : the json version takes 24ms whereas the gwt version takes 18s > ... > > ON THE CLIENT SIDE : > > // JSON Button : > requestButton.addClickHandler(new ClickHandler() { > public void onClick(ClickEvent event) { > ClientResource r = new > ClientResource("/restlet/operations/byAccDate/start01102010/end10102010"); > r.setOnResponse(new Uniform() { > public void handle(Request request, Response response) { > try { > respAreaLabel.setText(response.getEntity().getText()); > } catch (IOException e) { > e.printStackTrace(); > } > } > }); > r.get(MediaType.APPLICATION_JSON); > } > }); > > // GWT Button : > btReqAllOpe.addClickHandler(new ClickHandler() { > public void onClick(ClickEvent event) { > OperationsProxy orp = GWT.create(OperationsProxy.class); > > > orp.getClientResource().setReference("/restlet/operations/byAccDate/start01102010/end10102010"); > > orp.getClientResource().getClientInfo().getAcceptedMediaTypes().add(new > Preference<MediaType>(MediaType.APPLICATION_JAVA_OBJECT_GWT)); > orp.retrieve(new Result< Operations >() { > public void onFailure(Throwable caught) { > String st = "error:" + caught.getMessage(); > respAreaLabel.setText(st); > } > @Override > public void onSuccess(Operations opeList) { > for (Operation ope : opeList) { > addRowOpe(ft , ope); > } > } > }); > > } > }); > > ON THE SERVER SIDE : > public class CopyOfOperationsServerRessource extends ServerResource > implements OperationsServerRessource_Int { > > private OperationDaoInterface opeDao; > > public void setOpeDao(OperationDaoInterface opeDao) { > this.opeDao = opeDao; > } > > public OperationDaoInterface getOpeDao() { > return opeDao; > } > > @Get > public Operations retrieve() { > ArrayList<Operation> result = new Operations(opeDao.getAll()) ; > return new Operations(result) ; > } > > @Get("json") > public JsonRepresentation retrieveJson() { > ArrayList<Operation> result = new Operations(opeDao.getAll()) ; > XStream xstream = new XStream(new JsonHierarchicalStreamDriver()); > xstream.setMode(XStream.NO_REFERENCES); > xstream.alias("operation", Operation.class); > return new JsonRepresentation( xstream.toXML(result) ); > } > } > > public interface OperationsProxy extends ClientProxy { > > @Get > public void retrieve(Result<Operations> callback); > > } > > I thought I correctly use the gwt plugin, but the performance gap with the > json version seems just too huge : I must have missed something : any idea ? > > regards ! > > Ben > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2699162 > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2699260

