我正在使用 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