getStatusCode
getStatusCode()
getStatusCode 方法返回 Response 对象的状态码。
返回值
Response 对象返回一个整数。
*
*
*
示例
以下是您能够如何在错误处理中使用 getStatusCode 的示例。
public static void processSetDebugResponse(Response response)
{
// check if response is successful or not
if(response.getStatusCode() == Response.STATUS_SUCCESS)
{
System.out.println("setDebug call processed with no warnings or errors");
}
else if(response.getStatusCode() == Response.STATUS_WARNING)
{
System.out.println("setDebug call processed with a warning");
}
else
{
System.out.println("setDebug call processed with an error");
}

// For any non-successes, there should be advisory messages explaining why
if(response.getStatusCode() != Response.STATUS_SUCCESS)
printDetailMessageOfWarningOrError("setDebug",
response.getAdvisoryMessages());
}