我使用GWT RequestBuilder并且我看到请求回调需要很长时间才能处理,尽管服务器端请求处理所需的时间很好,下面是我的代码,是否需要优先处理请求回拨所以它会很快处理
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URLs.getHpEquipmentIndigoDetails(equipmentId));
float timeStart = System.currentTimeMillis();
builder.sendRequest(null, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
if (SmartPlannerConstants.SUCCESS_STATUS == response.getStatusCode()) {
final float currentTime = System.currentTimeMillis();
Log.debug("Time consumed on send & recieve request " + (currentTime-timeStart));
// Initialize widget and update UI
}
@Override
public void onError(Request request, Throwable exception) {
SmartPlannerWindowManager.showError(exception);
}
});
final float timeEnd = System.currentTimeMillis();
Log.debug("Time consumed on send request " + (timeEnd-timeStart));
Result:
Time consumed on send request zero ms
Firebug says request handling on server is 200 ms
Time consumed on send & recieve request is 4000 ms