Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GWT应用程序中RPC与JSON的比较_Json_Gwt_Rpc - Fatal编程技术网

GWT应用程序中RPC与JSON的比较

GWT应用程序中RPC与JSON的比较,json,gwt,rpc,Json,Gwt,Rpc,这是一个简单但有力的问题 我有一个应用程序测试,它通过RPC和REST发送1000个CustomDTO列表 我只想知道反序列化有效负载(在RPC中)和JSON(在REST中)需要多少时间 我的问题是,我得到的时间包括: 客户端时间+服务器时间+连线时间+反序列化时间 是否有任何测试应用程序或util,甚至GWT util来获取反序列化时间,而不是其他时间 谢谢。您可以覆盖RemoteServiceServlet的一些方法。 然后可以测量序列化所花费的时间: protected void onBe

这是一个简单但有力的问题

我有一个应用程序测试,它通过RPC和REST发送1000个CustomDTO列表

我只想知道反序列化有效负载(在RPC中)和JSON(在REST中)需要多少时间

我的问题是,我得到的时间包括:

客户端时间+服务器时间+连线时间+反序列化时间

是否有任何测试应用程序或util,甚至GWT util来获取反序列化时间,而不是其他时间


谢谢。

您可以覆盖RemoteServiceServlet的一些方法。 然后可以测量序列化所花费的时间:

protected void onBeforeRequestDeserialized(String serializedRequest) {
}

protected void onAfterResponseSerialized(String serializedResponse) {
}

protected void onAfterRequestDeserialized(RPCRequest rpcRequest) {
}

但是我不知道有任何实用程序。

您可以覆盖RemoteServiceServlet的一些方法。 然后可以测量序列化所花费的时间:

protected void onBeforeRequestDeserialized(String serializedRequest) {
}

protected void onAfterResponseSerialized(String serializedResponse) {
}

protected void onAfterRequestDeserialized(RPCRequest rpcRequest) {
}

但我不知道有什么实用程序。

在应用程序中启用轻量级指标(http://code.google.com/webtoolkit/doc/latest/DevGuideLightweightMetrics.html)
GWT-RPC支持开箱即用,因此如果您能够看到每个GWT-RPC请求在序列化/反序列化上花费了多少时间,请在应用程序中启用轻量级度量(http://code.google.com/webtoolkit/doc/latest/DevGuideLightweightMetrics.html)
GWT-RPC支持开箱即用,因此如果您能够看到每个GWT-RPC请求在序列化/反序列化上花费了多少时间,那么这是一个服务器类吗?我对客户机中的反序列化感兴趣。我认为您不能在客户机上这样做。我的意思是你可以解析响应,但那不是序列化。序列化是一种将java对象转换为json的技巧,反之亦然。它是在RemoteServiceServlet中完成的。如果使用GWT-RPC,则必须创建一个扩展此类的servlet。在这里,您可以覆盖这些方法。另外,重要的是要记住,RemoteServiceServlet会压缩响应。RemoteServiceServlet不会压缩响应,而是会压缩响应。请参阅RemoteServiceServlet中的以下方法:private void writeResponse(HttpServletRequest请求、HttpServletResponse响应、String responsePayload)它是可自定义的,但确实是zip。很抱歉不管怎样,谢谢。这是服务器类吗?我对客户机中的反序列化感兴趣。我认为您不能在客户机上这样做。我的意思是你可以解析响应,但那不是序列化。序列化是一种将java对象转换为json的技巧,反之亦然。它是在RemoteServiceServlet中完成的。如果使用GWT-RPC,则必须创建一个扩展此类的servlet。在这里,您可以覆盖这些方法。另外,重要的是要记住,RemoteServiceServlet会压缩响应。RemoteServiceServlet不会压缩响应,而是会压缩响应。请参阅RemoteServiceServlet中的以下方法:private void writeResponse(HttpServletRequest请求、HttpServletResponse响应、String responsePayload)它是可自定义的,但确实是zip。很抱歉无论如何,谢谢你。