Java Code Examples for com.google.gwt.http.client.Response.getText()

The following are Jave code examples for showing how to use getText() of the com.google.gwt.http.client.Response class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: LAS   File: ColumnEditorWidget.java   View Source Code Vote up 6 votes
@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 2
Project: gwt-jackson-rest   File: RestRequestCallback.java   View Source Code Vote up 6 votes
@Override
public void onResponseReceived(Request request, Response response) {
    if (isSuccessStatusCode(response)) {
        if (null != callback) {
            R result;
            if (null != responseConverter && null != response.getText() && !response.getText().isEmpty()) {
                try {
                    result = responseConverter.read(response.getText());
                } catch (Exception e) {
                    onError(request, e);
                    return;
                }
            } else {
                result = null;
            }
            callback.onSuccess(response, result);
        }
    } else {
        if (null != callback) {
            callback.onError(response);
        } else {
            throw new RestException("An error occured. Status : " + response.getStatusCode());
        }
    }
}
 
Example 3
Project: preferanser   File: ErrorHandlingRestyGwtRequestListener.java   View Source Code Vote up 6 votes
@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);
}
 
Example 4
Project: droopy   File: Main.java   View Source Code Vote up 6 votes
public final void onResponseReceived(final Request request, final Response response) {
  final String text = response.getText();
  if (text.isEmpty()) {
    final int code = response.getStatusCode();
    final String errmsg;
    if (code == 0) {  // Happens when a cross-domain request fails to connect.
      errmsg = ("Failed to connect to " + server + ", check that the server"
                + " is up and that you can connect to it.");
    } else {
      errmsg = ("Empty response from server: code=" + code
                + " status=" + response.getStatusText());
    }
    onError(request, new RuntimeException(errmsg));
  } else {
    JSONValue value;
    try {
      value = JSONParser.parseStrict(text);
    } catch (JSONException e) {
      onError(request, e);
      return;
    }
    onSuccess(value);
  }
}
 
Example 5
Project: gwt-upload   File: Uploader.java   View Source Code Vote up 6 votes
public void onResponseReceived(Request request, Response response) {
  hasSession = true;
  try {
    String s = Utils.getXmlNodeValue(XMLParser.parse(response.getText()), TAG_BLOBSTORE);
    blobstore = "true".equalsIgnoreCase(s);
    // with blobstore status does not make sense
    if (blobstore) {
      updateStatusTimer.setInterval(5000);
    }
    uploadForm.submit();
  } catch (Exception e) {
    String message = e.getMessage().contains("error:") 
        ? i18nStrs.uploaderServerUnavailable() + " (3) " + getServletPath() + "\n\n" + i18nStrs.uploaderServerError() + "\nAction: " + getServletPath() + "\nException: " + e.getMessage() + response.getText()
        : i18nStrs.submitError();
    cancelUpload( message);
  }
}
 
Example 6
Project: optashift-employee-rostering   File: FailureShownRestCallback.java   View Source Code Vote up 5 votes
@Override
public void onError(Response response) {
    String message = "Error calling REST method with status (" + response.getStatusCode() + ": " + response.getStatusText() + ") and text (" +
        response.getText() + ").";
    ErrorPopup.show(message);
    throw new IllegalStateException(message);
}
 
Example 7
Project: LAS   File: LASAnnotationsPanel.java   View Source Code Vote up 5 votes
@Override
public void onResponseReceived(Request request, Response response) {

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

}
 
Example 8
Project: LAS   File: CruiseIconWidget.java   View Source Code Vote up 5 votes
@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 9
Project: LAS   File: InventoryMap.java   View Source Code Vote up 5 votes
@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 10
Project: LAS   File: InventoryMap.java   View Source Code Vote up 5 votes
@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 11
Project: che   File: DtoUnmarshaller.java   View Source Code Vote up 5 votes
/** {@inheritDoc} */
@Override
public void unmarshal(Response response) {
  if (response.getText() != null) {
    if (isJsonArray(response)) {
      payload = (T) dtoFactory.createListDtoFromJson(response.getText(), dtoInterface);
    } else {
      payload = (T) dtoFactory.createDtoFromJson(response.getText(), dtoInterface);
    }
  }
}
 
Example 12
Project: Peergos   File: JSON.java   View Source Code Vote up 5 votes
public void onResponseReceived(Request request, Response response) {
  String responseText = response.getText();
  try {
    JSONValue jsonValue = JSONParser.parse(responseText);
    displayJSONObject(jsonValue);
  } catch (JSONException e) {
    displayParseError(responseText);
  }
  resetSearchButtonCaption();
}
 
Example 13
Project: swarm   File: JSON.java   View Source Code Vote up 5 votes
public void onResponseReceived(Request request, Response response) {
  String responseText = response.getText();
  try {
    JSONValue jsonValue = JSONParser.parse(responseText);
    displayJSONObject(jsonValue);
  } catch (JSONException e) {
    displayParseError(responseText);
  }
  resetSearchButtonCaption();
}
 
Example 14
Project: LAS   File: CruiseIconWidget.java   View Source Code Vote up 4 votes
@Override
public void onResponseReceived(Request request, Response response) {
	String doc = response.getText();
	load(doc);
	
}
 
Example 15
Project: che   File: StringUnmarshaller.java   View Source Code Vote up 4 votes
/** {@inheritDoc} */
@Override
public void unmarshal(Response response) {
  builder = response.getText();
}
 
Example 16
Project: opennmszh   File: KscReportRestResponseMapper.java   View Source Code Vote up 4 votes
public static List<KscReport> translate(final Response response) {
    final String jsonText = response.getText();
    return translate(jsonText);
}
 
Example 17
Project: OpenNMS   File: KscReportRestResponseMapper.java   View Source Code Vote up 4 votes
public static List<KscReport> translate(final Response response) {
    final String jsonText = response.getText();
    return translate(jsonText);
}
 
Example 18
Project: OpenNMS   File: KscReportRestResponseMapper.java   View Source Code Vote up 4 votes
public static List<KscReport> translate(final Response response) {
    final String jsonText = response.getText();
    return translate(jsonText);
}
 
Example 19
Project: LAS   File: LASAnnotationsButton.java   View Source Code Vote up 3 votes
@Override
public void onResponseReceived(Request request, Response response) {
	
	String text = response.getText();
	setAnnotations(text);
	
}
 
Example 20
Project: LAS   File: LASAnnotationsPanel.java   View Source Code Vote up 3 votes
@Override
public void onResponseReceived(Request request, Response response) {

	String text = response.getText();
	setAnnotations(text);

}