Java Code Examples for com.google.gwt.http.client.Request

The following are top voted examples for showing how to use com.google.gwt.http.client.Request. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: empiria.player   File: SynchronousScriptsLoaderTest.java   View source code 6 votes vote down vote up
@Test
public void shouldFireOnLoad_afterLastScriptLoaded() {
    // given
    ScriptUrl[] scripts = new ScriptUrl[]{firstScript, secondScript};
    Request request = mock(Request.class);
    Response response = mock(Response.class);
    when(response.getText()).thenReturn(RESPONSE_TEXT);

    // when
    testObj.injectScripts(scripts, synchronousScriptsCallback);
    verify(requestWrapper).get(eq(FIRST_SCRIPT_URL), requestCallbackCaptor.capture());
    RequestCallback requestCallback = requestCallbackCaptor.getValue();
    requestCallback.onResponseReceived(request, response);

    // then
    verify(scriptInjectorWrapper).fromString(RESPONSE_TEXT);

    verify(requestWrapper).get(SECOND_SCRIPT_URL, requestCallback);
    requestCallback.onResponseReceived(request, response);
    verify(synchronousScriptsCallback).onLoad();
}
 
Example 2
Project: sig-seguimiento-vehiculos   File: AbstractGitHubGetListRequest.java   View source code 6 votes vote down vote up
protected RestErrorCallback getErrorCallback() {
	return new RestErrorCallback() {

		@Override
		public boolean error(Request request, Throwable throwable) {
			autoMessageBox.hide();
			String message = "";
			int defaultCodeError = Response.SC_NOT_MODIFIED;
			try {
				throw throwable;
			} catch (ResponseException e) {
				Response response = e.getResponse();					
				message = response.getStatusText(); 
				defaultCodeError = response.getStatusCode();
				
			} catch (Throwable t) {
				message = t.getMessage();
			}
			
			messageDialogBuilder.createError(UIMessages.INSTANCE.warning() + " " + defaultCodeError, message).show();
			
			return false;
		}
	};
}
 
Example 3
Project: sig-seguimiento-vehiculos   File: GitHubGetRepositoryListRequest.java   View source code 6 votes vote down vote up
private RestErrorCallback getErrorCallback() {
	return new RestErrorCallback() {

		@Override
		public boolean error(Request request, Throwable throwable) {
			autoMessageBox.hide();
			String message = "";
			int defaultCodeError = Response.SC_NOT_MODIFIED;
			try {
				throw throwable;
			} catch (ResponseException e) {
				Response response = e.getResponse();					
				message = response.getStatusText(); 
				defaultCodeError = response.getStatusCode();
				
			} catch (Throwable t) {
				message = t.getMessage();
			}
			
			messageDialogBuilder.createError(UIMessages.INSTANCE.warning() + " " + defaultCodeError, message).show();
			
			return false;
		}
	};
}
 
Example 4
Project: sig-seguimiento-vehiculos   File: GitHubGetFileRequest.java   View source code 6 votes vote down vote up
private RestErrorCallback getErrorCallback() {
	return new RestErrorCallback() {

		@Override
		public boolean error(Request request, Throwable throwable) {
			autoMessageBox.hide();
			String message = "";
			int defaultCodeError = Response.SC_NOT_MODIFIED;
			try {
				throw throwable;
			} catch (ResponseException e) {
				Response response = e.getResponse();					
				message = response.getStatusText(); 
				defaultCodeError = response.getStatusCode();
				
			} catch (Throwable t) {
				message = t.getMessage();
			}
			
			messageDialogBuilder.createError(UIMessages.INSTANCE.warning() + " " + defaultCodeError, message).show();
			
			return false;
		}
	};
}
 
Example 5
Project: sig-seguimiento-vehiculos   File: GitHubUpdateFileExporter.java   View source code 6 votes vote down vote up
private RestErrorCallback getErrorCallback() {
	return new RestErrorCallback() {

		@Override
		public boolean error(Request request, Throwable throwable) {
			autoMessageBox.hide();
			String message = "";
			int defaultCodeError = Response.SC_NOT_MODIFIED;
			try {
				throw throwable;
			} catch (ResponseException e) {
				Response response = e.getResponse();					
				message = response.getStatusText(); 
				defaultCodeError = response.getStatusCode();
				
			} catch (Throwable t) {
				message = t.getMessage();
			}
			
			messageDialogBuilder.createError(UIMessages.INSTANCE.warning() + " " + defaultCodeError, message).show();
			
			return false;
		}
	};
}
 
Example 6
Project: WebConsole   File: JSONControllerConnector.java   View source code 6 votes vote down vote up
private void doJsonRequest(String url, String username, String password, JSONControllerCallback callback, Integer timeout) {
	RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
	Request request = null;
	
	// Add accept header
	builder.setHeader("Accept", "application/json");
	
	if (username != null && username.length() > 0) {
		if (password == null) password = "";
		
		// Add authentication header
		String authStr = username + ":" + password;
		String authEnc = "Basic " + BrowserUtils.base64Encode(authStr);
		builder.setHeader("Authorization", authEnc);
	}
	
	builder.setCallback(callback);
	
	if (timeout != null) {
		builder.setTimeoutMillis(timeout);
	}
	
   try {
 		request = builder.send();
   } catch (RequestException e) {
 		callback.onError(request, e);
   }
}
 
Example 7
Project: LAS   File: ColumnEditorWidget.java   View source code 6 votes vote down vote up
@Override
public void onResponseReceived(Request request, Response response) {
    String text = response.getText();
    PopupPanel popup = new PopupPanel(true);
    popup.add(new HTML("<strong>Saved edits for:<p></p></strong>"+text+"<p></p>Click outside box to dismiss."));
    popup.setPopupPosition(200, Window.getClientHeight()/3);
    popup.show();
    CellFormatter formatter = datatable.getCellFormatter();
    for (Iterator dirtyIt = dirtyrows.keySet().iterator(); dirtyIt.hasNext();) {
        Integer widgetrow = (Integer) dirtyIt.next();
        for (int i = 0; i < headers.length; i++) {
            formatter.removeStyleName(widgetrow, i, "dirty");
        }
        
        CheckBox box = (CheckBox) datatable.getWidget(widgetrow, 0);
        box.setValue(false);
    }
    dirtyrows.clear();
}
 
Example 8
Project: gwt-syncproxy   File: RunTimeSerializationErrorsTest.java   View source code 6 votes vote down vote up
public void testBadSerialization2() {
	final boolean[] callbackFired = new boolean[] { false };

	Request req = getService().echoRequest(
			new MixedSerializable.NonSerializableSub(),
			new AsyncCallback<MixedSerializable>() {
				@Override
				public void onFailure(Throwable caught) {
					callbackFired[0] = true;
				}

				@Override
				public void onSuccess(MixedSerializable result) {
					fail("RPC request should have failed");
				}
			});

	assertTrue(callbackFired[0]); // should have happened synchronously
	assertFalse(req.isPending());
	req.cancel();
}
 
Example 9
Project: gwt-syncproxy   File: RunTimeSerializationErrorsTest.java   View source code 6 votes vote down vote up
public void testBadSerialization2() {
	final boolean[] callbackFired = new boolean[] { false };

	Request req = getService().echoRequest(
			new MixedSerializable.NonSerializableSub(),
			new AsyncCallback<MixedSerializable>() {
				@Override
				public void onFailure(Throwable caught) {
					callbackFired[0] = true;
				}

				@Override
				public void onSuccess(MixedSerializable result) {
					fail("RPC request should have failed");
				}
			});

	assertTrue(callbackFired[0]); // should have happened synchronously
	assertFalse(req.isPending());
	req.cancel();
}
 
Example 10
Project: shortyz   File: RetryLocalStorageServiceProxy.java   View source code 6 votes vote down vote up
@Override
public Request listPuzzles(final AsyncCallback<PuzzleDescriptor[]> callback) {
    return super.listPuzzles( new AsyncCallback<PuzzleDescriptor[]>(){

        @Override
        public void onFailure(Throwable caught) {
            if(caught instanceof InvocationException){
                RetryLocalStorageServiceProxy.super.listPuzzles(callback);
            } else {
                callback.onFailure(caught);
            }
        }

        @Override
        public void onSuccess(PuzzleDescriptor[] result) {
            callback.onSuccess(result);
        }

    });
}
 
Example 11
Project: shortyz   File: LocalStorageServiceProxy.java   View source code 6 votes vote down vote up
@Override
public Request savePuzzle(final Long listingId, final Puzzle puzzle, final AsyncCallback callback) {
    if(!WindowContext.INSTANCE.isInitialized()){
        WindowContext.INSTANCE.initialize( new WindowContextCallback(){

            @Override
            public void onInitialized() {
                saveInternal(listingId, puzzle, callback);
            }

        });
    } else {

        saveInternal(listingId, puzzle, callback);
    }
    return new FakeRequest();
}
 
Example 12
Project: onecmdb   File: MDRStartWidget.java   View source code 6 votes vote down vote up
public void doStop() {
 for (TabItem item : advanced.getItems()) {
	 final CIModel model = (CIModel)item.getData("model");

	 // Do a HTTP request..
	 RequestBuilder req = new RequestBuilder(RequestBuilder.GET, getStopURL(model));

	 try {
		 Info.display("Stop", "Send stop to " + model.getDisplayName());
		 req.sendRequest(null, new RequestCallback() {

			 public void onResponseReceived(Request request, Response response) {
				 Info.display("Stop", "COMPLETED. Stop sent to " + model.getDisplayName());
			 }

			 public void onError(Request arg0, Throwable arg1) {
				 Info.display("Stop", "FAILED. to stop " + model.getDisplayName());
			 }
		 });

	 } catch (RequestException e) {
		 Info.display("Stop", "ERROR. to stop " + model.getDisplayName());
	 } 
 }
}
 
Example 13
Project: geowe-core   File: AbstractGitHubGetListRequest.java   View source code 6 votes vote down vote up
protected RestErrorCallback getErrorCallback() {
	return new RestErrorCallback() {

		@Override
		public boolean error(Request request, Throwable throwable) {
			autoMessageBox.hide();
			String message = "";
			int defaultCodeError = Response.SC_NOT_MODIFIED;
			try {
				throw throwable;
			} catch (ResponseException e) {
				Response response = e.getResponse();					
				message = response.getStatusText(); 
				defaultCodeError = response.getStatusCode();
				
			} catch (Throwable t) {
				message = t.getMessage();
			}
			
			messageDialogBuilder.createError(UIMessages.INSTANCE.warning() + " " + defaultCodeError, message).show();
			
			return false;
		}
	};
}
 
Example 14
Project: geowe-core   File: GitHubGetRepositoryListRequest.java   View source code 6 votes vote down vote up
private RestErrorCallback getErrorCallback() {
	return new RestErrorCallback() {

		@Override
		public boolean error(Request request, Throwable throwable) {
			autoMessageBox.hide();
			String message = "";
			int defaultCodeError = Response.SC_NOT_MODIFIED;
			try {
				throw throwable;
			} catch (ResponseException e) {
				Response response = e.getResponse();					
				message = response.getStatusText(); 
				defaultCodeError = response.getStatusCode();
				
			} catch (Throwable t) {
				message = t.getMessage();
			}
			
			messageDialogBuilder.createError(UIMessages.INSTANCE.warning() + " " + defaultCodeError, message).show();
			
			return false;
		}
	};
}
 
Example 15
Project: geowe-core   File: GitHubUpdateFileExporter.java   View source code 6 votes vote down vote up
private RestErrorCallback getErrorCallback() {
	return new RestErrorCallback() {

		@Override
		public boolean error(Request request, Throwable throwable) {
			autoMessageBox.hide();
			String message = "";
			int defaultCodeError = Response.SC_NOT_MODIFIED;
			try {
				throw throwable;
			} catch (ResponseException e) {
				Response response = e.getResponse();					
				message = response.getStatusText(); 
				defaultCodeError = response.getStatusCode();
				
			} catch (Throwable t) {
				message = t.getMessage();
			}
			
			messageDialogBuilder.createError(UIMessages.INSTANCE.warning() + " " + defaultCodeError, message).show();
			
			return false;
		}
	};
}
 
Example 16
Project: unitimes   File: GwtRpcProxy.java   View source code 5 votes vote down vote up
@Override
   protected <T> Request doInvoke(ResponseReader responseReader, final String methodName, RpcStatsContext statsContext, String requestData, final AsyncCallback<T> callback) {
	return super.doInvoke(responseReader, methodName, statsContext, requestData, new AsyncCallback<T>() {
		@Override
		public void onFailure(Throwable caught) {
			UniTimeNotifications.error("Request " + methodName.replace("_Proxy", "") + " failed: " + caught.getMessage(), caught);
			callback.onFailure(caught);
		}
		@Override
		public void onSuccess(T result) {
			callback.onSuccess(result);
		}
	});
}
 
Example 17
Project: sig-seguimiento-vehiculos   File: JoinDataTool.java   View source code 5 votes vote down vote up
private void lodaDataFromURL(final String url) {
	final String urlBase = GWT.getHostPageBaseURL() + "gwtOpenLayersProxy";
	try {
		autoMessageBox.show();
		RestClient.create(URLFileRestService.class, urlBase,
				new RemoteCallback<String>() {
					@Override
					public void callback(String response) {
						parseCsvData(response);
						autoMessageBox.hide();
					}
				}, new RestErrorCallback() {
					@Override
					public boolean error(Request message,
							Throwable throwable) {
						autoMessageBox.hide();

						showAlert("Error"
								+ UIMessages.INSTANCE.unexpectedError());
						return false;
					}
				}, Response.SC_OK).getContent(url);
	} catch (Exception e) {
		autoMessageBox.hide();
		showAlert("Error loading data..." + e.getMessage());
	}
}
 
Example 18
Project: sig-seguimiento-vehiculos   File: URLVectorLayerDef.java   View source code 5 votes vote down vote up
protected void createLayerFromURL() {
	final ProgressBarDialog autoMessageBox = new ProgressBarDialog(false,
			UIMessages.INSTANCE.processing());
	try {
		autoMessageBox.show();
		RestClient.create(URLFileRestService.class, URL_BASE,
				new RemoteCallback<String>() {
					@Override
					public void callback(String response) {
						final VectorLayerConfig layerConfig = getVectorLayerConfig();
						layerConfig.setGeoDataString(response);
						VectorLayer layer = VectorLayerFactory
								.createVectorLayerFromGeoData(layerConfig);
						LayerLoader.load(layer);
						autoMessageBox.hide();
					}
				}, new RestErrorCallback() {
					@Override
					public boolean error(Request message,
							Throwable throwable) {
						autoMessageBox.hide();

						showDialog("Error",
								UIMessages.INSTANCE.unexpectedError());
						return false;
					}
				}, Response.SC_OK).getContent(getUrl());
	} catch (Exception e) {
		autoMessageBox.hide();
		showDialog(
				UIMessages.INSTANCE.errorLoadingLayer(getVectorLayerConfig()
						.getLayerName()),
				UIMessages.INSTANCE.unexpectedError());
	}
}
 
Example 19
Project: sig-seguimiento-vehiculos   File: RouteVehicleTool.java   View source code 5 votes vote down vote up
private void getRequestRegisteredPoint(final VehicleJSO vehicle, final String startDate, final String endDate) {
	autoMessageBox.setProgressStatusMessage(UISgfMessages.INSTANCE.getGPSData());
	
	RestClient.create(SGFRegisteredPointService.class, SGFServiceInfo.getURL(),
			new RemoteCallback<String>() {

				@Override
				public void callback(String pointRegisterListResponseJson) {	
					
					
					PointRegisterListResponseJSO pointRegisterResponse = JsonUtils
							.safeEval(pointRegisterListResponseJson);
					PointRegisterJSO[] pointRegisters = pointRegisterResponse
							.getPointRegisterListEmbededJSO().getPointRegister();
					List<PointRegisterJSO> points = Arrays.asList(pointRegisters);
					
					if(points.isEmpty()) {
						messageDialogBuilder.createInfo(UIMessages.INSTANCE.edtAlertDialogTitle(),  UISgfMessages.INSTANCE.gpsDataNotFound()).show();
						return;
					}
					
					createRouteLayer(vehicle, startDate, points);
					autoMessageBox.hide();

				}
			},

			new RestErrorCallback() {
				
				@Override
				public boolean error(Request message, Throwable throwable) {
					autoMessageBox.hide();
					messageDialogBuilder.createInfo(UISgfMessages.INSTANCE.errorDetected(),  throwable.getMessage()).show();
					
					return false;
				}
			}, Response.SC_OK).getRegisteredPoints(session.getToken(), vehicle.getId(), startDate, endDate, REGISTERED_POINTS_TO_LOAD, "date,desc");			
}
 
Example 20
Project: sig-seguimiento-vehiculos   File: VehicleTool.java   View source code 5 votes vote down vote up
private void loadVehicles(String token, int companyId) {
	autoMessageBox = new ProgressBarDialog(false,
			UIMessages.INSTANCE.processing());
	autoMessageBox.show();

	RestClient.create(SGFVehicleService.class, SGFServiceInfo.getURL(),
			new RemoteCallback<String>() {

				@Override
				public void callback(String vehicleListResponseJson) {
					VehicleListResponseJSO vehicleListResponse = JsonUtils
							.safeEval(vehicleListResponseJson);
					List<VehicleJSO> vehicles = Arrays
							.asList(vehicleListResponse
									.getVehicleListEmbededJSO()
									.getVehicles());

					vehicleDialog.setVehicle(vehicles);
					autoMessageBox.hide();
					vehicleDialog.show();

				}
			},

			new RestErrorCallback() {

				@Override
				public boolean error(Request message, Throwable throwable) {
					autoMessageBox.hide();
					messageDialogBuilder.createInfo(
							UISgfMessages.INSTANCE.errorDetected(),
							throwable.getMessage()).show();

					return false;
				}
			}, Response.SC_OK).get(token, companyId, 100, "id");
}
 
Example 21
Project: sig-seguimiento-vehiculos   File: GitHubCreateFileExporter.java   View source code 5 votes vote down vote up
private RestErrorCallback getErrorCallback() {
	return new RestErrorCallback() {

		@Override
		public boolean error(Request request, Throwable throwable) {
			autoMessageBox.hide();
			String message = "";
			int defaultCodeError = Response.SC_NOT_MODIFIED;
			try {
				throw throwable;
			} catch (ResponseException e) {
				Response response = e.getResponse();
				message = response.getStatusText();
				defaultCodeError = response.getStatusCode();

			} catch (Throwable t) {
				message = t.getMessage();
			}

			messageDialogBuilder.createError(
					UIMessages.INSTANCE.warning() + " " + defaultCodeError,
					message).show();

			return false;
		}
	};
}
 
Example 22
Project: test-errai4-tomcat   File: AppEntryPoint.java   View source code 5 votes vote down vote up
private void getPersonList() {
    final RemoteCallback<List<Person>> successCallback = new RemoteCallback<List<Person>>() {

        public void callback(List<Person> personList) {
            final StringBuilder personListStringBuilder = new StringBuilder(250/*capacity*/);
            Person person;
            personListStringBuilder.append("[");
            for (Iterator<Person> iterator = personList.iterator(); iterator.hasNext();) {
                person = iterator.next();
                personListStringBuilder.append(person.getFirstName());
                if (iterator.hasNext()) {
                    personListStringBuilder.append(", ");
                }
            }
            personListStringBuilder.append("]");
            setStatus("Response from server: " + personListStringBuilder.toString());

        }

    };

    final ErrorCallback errorCallback = new RestErrorCallback() {

        public boolean error(Request request, Throwable throwable) {
            setStatus("Response from server: " + throwable.getMessage());

            return false;

        }

    };

    setStatus("call REST service from Errai JAX-RS Client ...");
    personServiceCaller.call(successCallback, errorCallback).findAll();
}
 
Example 23
Project: LAS   File: OutputPanel.java   View source code 5 votes vote down vote up
@Override
public void onError(Request request, Throwable exception) {
    currentURL = currentURL + "&error=true";
    spin.hide();
    updating = false;
    HTML error = new HTML(HtmlSanitizerUtil.sanitizeHtml(exception.toString()));
    Widget size = grid.getWidget(plotRow, 0);
    error.setSize(image_w * imageScaleRatio + "px", image_h * imageScaleRatio + "px");
    grid.setWidget(plotRow, 0, error);
    if (pending) {
        pending = false;
    }
}
 
Example 24
Project: LAS   File: LASAnnotationsPanel.java   View source code 5 votes vote down vote up
@Override
public void onError(Request request, Throwable exception) {
	// TODO Auto-generated method stub
	GWT.log("onError(Request request, Throwable exception) called by annotationsXMLCallback");
	GWT.log("request");
	GWT.log(request.toString());
	GWT.log("exception");
	GWT.log(exception.toString());
	exception.printStackTrace();
}
 
Example 25
Project: LAS   File: LASAnnotationsPanel.java   View source code 5 votes vote down vote up
@Override
public void onError(Request request, Throwable exception) {
	// TODO Auto-generated method stub
	GWT.log("onError(Request request, Throwable exception) called by annotationsHTMLCallback");
	GWT.log("request");
	GWT.log(request.toString());
	GWT.log("exception");
	GWT.log(exception.toString());
	exception.printStackTrace();
}
 
Example 26
Project: LAS   File: LASAnnotationsPanel.java   View source code 5 votes vote down vote up
@Override
public void onResponseReceived(Request request, Response response) {

	String text = response.getText();
	setAnnotationsHTML(text);
	eventBus.fireEventFromSource(new ResizeEvent(), LASAnnotationsPanel.this);

}
 
Example 27
Project: LAS   File: CruiseIconWidget.java   View source code 5 votes vote down vote up
@Override
public void onResponseReceived(Request request, Response response) {
	String doc = response.getText();
	if ( doc != null && !doc.equals("") && doc.contains("<?xml") ) {
	    load(doc);
	}
          setCheckedIcons(checkedIcons);
}
 
Example 28
Project: LAS   File: InventoryMap.java   View source code 5 votes vote down vote up
@Override
public void onResponseReceived(Request request, Response response) {
	String text = response.getText();
	HTML html = new HTML(HtmlSanitizerUtil.sanitizeHtml(text));
	navbarheader.clear();
	navbarheader.add(html);
}
 
Example 29
Project: LAS   File: InventoryMap.java   View source code 5 votes vote down vote up
@Override
public void onResponseReceived(Request request, Response response) {
	String text = response.getText();
	HTML html = new HTML(HtmlSanitizerUtil.sanitizeHtml(text));
	navbarfooter.clear();
	navbarfooter.add(html);
}
 
Example 30
Project: LAS   File: LASResponseEvent.java   View source code 5 votes vote down vote up
public LASResponseEvent(Request request, Response response,
		String callerObjectName, String callbackObjectName) {
	this.request = request;
	this.response = response;
	this.callerObjectName = callerObjectName;
       this.callbackObjectName = callbackObjectName;
       this.setResponseReceived(true);
}
 
Example 31
Project: LAS   File: LASResponseEvent.java   View source code 5 votes vote down vote up
public LASResponseEvent(Request request, Throwable exception,
		String callerObjectName, String callbackObjectName) {
	this.request = request;
	this.exception = exception;
       this.callbackObjectName = callbackObjectName;
       this.setResponseReceived(false);
}
 
Example 32
Project: LAS   File: MultiCallback.java   View source code 5 votes vote down vote up
@Override
public void onResponseReceived(Request request, Response response) {
	controller.done(this);
	for (ArrayList<String> callbackPair : callbackPairs) {
		LASResponseEvent lasResponseEvent = new LASResponseEvent(request,
				response, callbackPair.get(0), callbackPair.get(1));
		logger.info("MultiCallback is firing lasResponseEvent:"
				+ lasResponseEvent + "for callbackPair:" + callbackPair
				+ " with response:" + response);
		eventBus.fireEventFromSource(lasResponseEvent, this);
	}
}
 
Example 33
Project: LAS   File: MultiCallback.java   View source code 5 votes vote down vote up
@Override
public void onError(Request request, Throwable exception) {
	controller.done(this);
	for (ArrayList<String> callbackPair : callbackPairs) {
		LASResponseEvent lasResponseEvent = new LASResponseEvent(request,
				exception, callbackPair.get(0), callbackPair.get(1));
		logger.info("MultiCallback is firing lasResponseEvent:"
				+ lasResponseEvent + "for callbackObjectName:"
				+ callbackPair + " with exception:" + exception);
		eventBus.fireEventFromSource(lasResponseEvent, this);
	}
}
 
Example 34
Project: mentor   File: UnitService.java   View source code 5 votes vote down vote up
@GET
public Request list(
	@QueryParam("type") Unit.Type type,
	@QueryParam("title") String title,
	@QueryParam("author") UUID authorId,
	@QueryParam("lecture") UUID lectureId,
	@QueryParam("count") Integer count,
	@QueryParam("offset") Integer offset,
	MethodCallback<List<Unit>> callback);
 
Example 35
Project: mentor   File: LectureService.java   View source code 5 votes vote down vote up
@GET
public Request list(
	@QueryParam("title") String title,
	@QueryParam("author") UUID authorId,
	@QueryParam("course") UUID courseId,
	@QueryParam("count") Integer count,
	@QueryParam("offset") Integer offset,
	MethodCallback<List<Lecture>> callback);
 
Example 36
Project: mentor   File: CourseService.java   View source code 5 votes vote down vote up
@GET
public Request list(
	@QueryParam("title") String title,
	@QueryParam("author") UUID authorId,
	@QueryParam("count") Integer count,
	@QueryParam("offset") Integer offset,
	MethodCallback<List<Course>> callback);
 
Example 37
Project: mentor   File: UserService.java   View source code 5 votes vote down vote up
@GET
public Request list(
	@QueryParam("name") String name,
	@QueryParam("email") String email,
	@QueryParam("count") Integer count,
	@QueryParam("offset") Integer offset,
	MethodCallback<List<User>> callback);
 
Example 38
Project: mentor   File: Loader.java   View source code 5 votes vote down vote up
public Loader<E> add(E component, Request request) {
	if (requests.containsKey(component))
		throw new IllegalStateException("Loading component " + component.toString() + " initialized more then once");
	requests.put(component, request);
	pending.add(component);
	return this;
}
 
Example 39
Project: cuba   File: CubaXhrConnection.java   View source code 5 votes vote down vote up
@Override
protected XhrResponseHandler createResponseHandler() {
    return new XhrResponseHandler() {
        protected int serverTimeOnClient;

        @Override
        public void onResponseReceived(Request request, Response response) {
            int statusCode = response.getStatusCode();
            if (statusCode == 200) {
                serverTimeOnClient = (int) Util.round(Profiler.getRelativeTimeMillis() - requestStartTime, 0);
            }
            super.onResponseReceived(request, response);
        }

        @Override
        protected void beforeHandlingMessage(ValueMap json) {
            super.beforeHandlingMessage(json);
            ScreenClientProfiler profiler = ScreenClientProfiler.getInstance();
            String profilerMarker = ScreenClientProfiler.getProfilerMarkerFromJson(json);
            if (profilerMarker != null) {
                int serverTimeOnServer = ScreenClientProfiler.getServerTimeFromJson(json);
                if (serverTimeOnServer > 0) {
                    profiler.registerServerTime(profilerMarker, serverTimeOnServer);
                    profiler.registerNetworkTime(profilerMarker, serverTimeOnClient - serverTimeOnServer);
                } else {
                    profiler.registerServerTime(profilerMarker, serverTimeOnClient);
                }
                profiler.registerEventTs(profilerMarker, ScreenClientProfiler.getEventTsFromJson(json));
            }
        }
    };
}
 
Example 40
Project: Wiab.pro   File: FakeSearchService.java   View source code 5 votes vote down vote up
@Override
public Request search(final String query, final int index, final int numResults, final Callback callback) {
  timer.scheduleDelayed(new Task() {
    @Override
    public void execute() {
      int from = Math.min(index, canned.size() - 1);
      int to = Math.max(index + numResults, canned.size());
      callback.onSuccess(query, canned.size(), canned.subList(from, to));
    }
  }, FAKE_DELAY_MS);
  return null;
}