本文整理汇总了Java中com.google.gwt.http.client.Response.getStatusText方法的典型用法代码示例。如果您正苦于以下问题:Java Response.getStatusText方法的具体用法?Java Response.getStatusText怎么用?Java Response.getStatusText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.http.client.Response
的用法示例。
在下文中一共展示了Response.getStatusText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getErrorCallback
import com.google.gwt.http.client.Response; //导入方法依赖的package包/类
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;
}
};
}
示例2: getErrorCallback
import com.google.gwt.http.client.Response; //导入方法依赖的package包/类
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;
}
};
}
示例3: onResponseReceived
import com.google.gwt.http.client.Response; //导入方法依赖的package包/类
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);
}
}
示例4: getErrorCallback
import com.google.gwt.http.client.Response; //导入方法依赖的package包/类
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;
}
};
}
示例5: onError
import com.google.gwt.http.client.Response; //导入方法依赖的package包/类
@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);
}
示例6: onResponseReceived
import com.google.gwt.http.client.Response; //导入方法依赖的package包/类
@Override
public void onResponseReceived(Request nativeRequest, Response nativeResponse)
{
TransactionRequest request = this.getDispatchedRequest(nativeRequest);
m_reusedResponse.clear();
int statusCode = nativeResponse.getStatusCode();
if( statusCode != Response.SC_OK )
{
String statusText = nativeResponse.getStatusText();
m_reusedResponse.setError(E_ResponseError.HTTP_ERROR);
this.onError(nativeRequest, request, m_reusedResponse);
return;
}
I_JsonObject responseJson = m_jsonFactory.createJsonObject(nativeResponse.getText());
m_reusedResponse.readJson(m_jsonFactory, responseJson);
if( !(request instanceof TransactionRequestBatch) )
{
m_callbacks.onResponseReceived(request, m_reusedResponse);
}
else
{
if( m_reusedResponse.getError() != E_ResponseError.NO_ERROR )
{
this.onError(nativeRequest, request, m_reusedResponse);
return;
}
TransactionRequestBatch batch = (TransactionRequestBatch) request;
I_JsonArray responseList = m_jsonFactory.getHelper().getJsonArray(responseJson, E_JsonKey.responseList);
m_callbacks.onResponseReceived(batch, responseList);
}
this.m_nativeRequestMap.remove(nativeRequest);
}