本文整理汇总了Java中org.fusesource.restygwt.client.Method类的典型用法代码示例。如果您正苦于以下问题:Java Method类的具体用法?Java Method怎么用?Java Method使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Method类属于org.fusesource.restygwt.client包,在下文中一共展示了Method类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeOnFailure
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
void executeOnFailure(Method method, Throwable exception) {
boolean isTimeoutError = checkTimeoutError(exception);
if (!isTimeoutError) {
String exceptionText = exception.getMessage();
if (exceptionText
.contains(ERROR_TEXT_RESPONSE_WAS_NOT_A_VALID_JSON)) {
logger.info(
"Response was NOT a valid JSON. Please check your date format and enum for RestyGWT.");
}
AbstractMethodCallback.this.onFailure(method, exception);
}
hideLoadingMessage(true);
}
示例2: executeCallService
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Ignore
@Test
public void executeCallService() {
doAnswer(invocationOnMock -> {
logger.info(invocationOnMock.getMock().toString());
((MethodCallback) invocationOnMock.getArguments()[0]).
onSuccess(any(Method.class), anyObject());
return null;
}).when(abstractMethodCallback)
.executeCallService(any(MethodCallback.class));
abstractMethodCallback.executeCallService(any(MethodCallback.class));
verify(abstractMethodCallback, times(1)).
onSuccess(any(Method.class), anyObject());
}
示例3: onFailure
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override
public void onFailure(Method method, Throwable throwable) {
String url = method.builder.getUrl();
App.getLogger().log(Level.SEVERE, "Error calling service " + url, throwable);
try {
// Decode the exception
if (throwable instanceof FailedStatusCodeException) {
FailedStatusCodeException sce = (FailedStatusCodeException) throwable;
App.getLogger().log(Level.SEVERE, "Service returned " + sce.getStatusCode() + sce.getMessage());
if (401 == sce.getStatusCode()) {
Window.Location.replace(LOGIN_FORM);
} else if (500 == sce.getStatusCode()) {
if ("UserNotRegisteredException".equals(sce.getMessage())) {
Window.Location.replace(SIGNUP_URL);
}
}
}
handleFailure(throwable);
} finally {
reset(null);
}
}
示例4: onFailure
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override
public void onFailure(Method method, Throwable exception) {
fireResponseEvent(method);
boolean caught = false;
for (MethodCallback<T> methodCallback : callbackList) {
try {
methodCallback.onFailure(method, exception);
caught = true;
} catch (RuntimeException e) {
// Exception not handled.
continue;
}
}
if (!caught) {
GWT.reportUncaughtException(exception);
}
}
示例5: afterClientErrorHandled
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override public void afterClientErrorHandled(Method method, Request request, Response response) {
String errorMessage;
switch (response.getStatusCode()) {
case 0:
return; // Ignore
case 401: // Unauthorized
placeManager.revealDefaultPlace();
errorMessage = "Для просмотра данной страницы необходимо войти в систему.";
break;
case 404: // Not found
errorMessage = "Объект не найден.";
break;
default:
errorMessage = "HTTP response error: " + response.getText();
Window.alert("Обработка запроса завершилась ошибкой. " +
"Подробная информация об ошибке доступна в консоли браузера. " +
"Пожалуйста, обновите текущую страницу или начните с главной.");
}
log.severe(errorMessage);
}
示例6: saveDrawing
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override public void saveDrawing() {
final Player player = getPlayerOrThrow();
checkState(player.hasRedoTurns() || player.hasUndoTurns());
applicationDialogs.showSaveDrawingDialog(new NameDescriptionSetter() {
@Override public void setNameDescription(String name, String description) {
Drawing unsavedDrawing = new Drawing(null, userIdOptional.get(), dealIdOptional.get(), name, description, player.getTurns(), Clock.getNow());
drawingService.save(unsavedDrawing, new Response<Drawing>() {
@Override public void onSuccess(Method method, Drawing savedDrawing) {
drawings.add(savedDrawing);
getView().displayDrawingsButton(true);
}
});
}
});
}
示例7: onFailure
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override
public void onFailure(Method method, Throwable exception) {
String className = method.getClass().getSimpleName();
String methodName = method.toString();
errorFormatter.showError(exception,
className + "." + methodName + ": onFailure: ");
}
示例8: onSuccess
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override
public void onSuccess(Method method, R responseObj) {
try {
handleSuccess(responseObj);
} finally {
reset(null);
}
}
示例9: filter
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override
public boolean filter(Method method, RequestBuilder builder) {
if(SessionStorage.getSession() != null)
builder.setHeader(UserSession.SESSION_HEADER,
SessionStorage.getSession().getSessionString());
return true;
}
示例10: onSuccess
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override
public void onSuccess(Method method, T response) {
fireResponseEvent(method);
for (MethodCallback<T> methodCallback : callbackList) {
methodCallback.onSuccess(method, response);
}
}
示例11: onFailure
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override
public void onFailure(Method method, Throwable caught) {
if (caught != null) {
if (caught instanceof RuntimeException) {
throw (RuntimeException) caught;
}
throw new RuntimeException(caught);
}
}
示例12: getSourceWriter
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) {
String packageName = this.handlerType.getPackage().getName();
String className =
this.proxyModelQualifiedName.indexOf('.') == -1 ?
this.proxyModelQualifiedName : this.proxyModelQualifiedName.substring(
this.proxyModelQualifiedName.lastIndexOf('.') + 1, this.proxyModelQualifiedName.length());
ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className);
composerFactory.addImport(AbstractServiceBinder.class.getName());
composerFactory.addImport(Arrays.class.getName());
composerFactory.addImport(Lists.class.getName());
composerFactory.addImport(MethodCallbackAdapter.class.getName());
composerFactory.addImport(Method.class.getName());
composerFactory.addImport(CompositeMethodCallback.class.getName());
composerFactory.addImport(CallbackAdapter.class.getName());
composerFactory.addImport(REST.class.getName());
composerFactory.addImport(GWT.class.getName());
composerFactory.addImport(this.serviceType.getQualifiedSourceName());
composerFactory.addImport(this.serviceBinderType.getQualifiedSourceName());
for (JType jType : this.imports) {
if (jType.isPrimitive() != null) {
continue;
}
composerFactory.addImport(jType.getQualifiedSourceName());
}
composerFactory.setSuperclass(AbstractServiceBinder.class.getSimpleName()
+ "<" + this.handlerType.getSimpleSourceName() + ", " + this.serviceType.getSimpleSourceName() + ">");
composerFactory.addImplementedInterface(this.serviceType.getSimpleSourceName());
composerFactory.addImplementedInterface(this.serviceBinderType.getSimpleSourceName());
return composerFactory.createSourceWriter(ctx, printWriter);
}
示例13: getRequestIdValue
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
public RequestIdValue getRequestIdValue(Method method) {
Map<String, String> methodData = method.getData();
if (methodData.containsKey("requestId")) {
String value = methodData.get("requestId");
String unquotedValue = value.substring(2, value.length() - 2);
return RequestIdValue.valueOf(unquotedValue);
}
return null;
}
示例14: onReveal
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override protected void onReveal() {
super.onReveal();
playerOptional = Optional.absent();
Response<Deal> dealResponse = new Response<Deal>() {
@Override public void onSuccess(Method method, Deal deal) {
DealEvent.fire(PlayerPresenter.this, deal);
}
};
if (userIdOptional.isPresent()) {
dealService.getUserDeal(userIdOptional.get(), dealIdOptional.get(), dealResponse);
} else {
dealService.getCurrentUserDeal(dealIdOptional.get(), dealResponse);
}
}
示例15: deleteDeal
import org.fusesource.restygwt.client.Method; //导入依赖的package包/类
@Override public void deleteDeal(final DealInfo deal) {
Long dealId = deal.getId();
checkNotNull(dealId, "Deal has null id, can't delete it!");
dealService.delete(dealId, new Response<Void>() {
@Override public void onSuccess(Method method, Void response) {
deals.remove(deal);
refreshView();
}
});
}