JavaTM Platform
Standard Ed. 6

java.net
类 HttpRetryException

java.lang.Object
  继承者 java.lang.Throwable
      继承者 java.lang.Exception
          继承者 java.io.IOException
              继承者 java.net.HttpRetryException
所有已实现的接口:
Serializable

public class HttpRetryException
extends IOException

抛出此异常指示 HTTP 请求需要重试,但由于启用了流模式而无法自动重试。

从以下版本开始:
1.5
另请参见:
序列化表格

构造方法摘要
HttpRetryException(String detail, int code)
          根据指定的响应代码和异常详细消息构造新 HttpRetryException
HttpRetryException(String detail, int code, String location)
          构造一个新 HttpRetryException,使其具有详细消息 responseCode 和 Location 响应头字段的内容。
 
方法摘要
 String getLocation()
          如果重定向产生错误,则返回 Location 头字段的值。
 String getReason()
          返回解释不能重试 http 请求的原因的字符串。
 int responseCode()
          返回 http 响应代码
 
从类 java.lang.Throwable 继承的方法
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

HttpRetryException

public HttpRetryException(String detail,
                          int code)
根据指定的响应代码和异常详细消息构造新 HttpRetryException

参数:
detail - 详细消息。
code - 发自服务器的 HTTP 响应代码。

HttpRetryException

public HttpRetryException(String detail,
                          int code,
                          String location)
构造一个新 HttpRetryException,使其具有详细消息 responseCode 和 Location 响应头字段的内容。

参数:
detail - 详细消息。
code - 发自服务器的 HTTP 响应代码。
location - 作为重定向目标的 URL
方法详细信息

responseCode

public int responseCode()
返回 http 响应代码

返回:
http 响应代码。

getReason

public String getReason()
返回解释不能重试 http 请求的原因的字符串。

返回:
原因字符串

getLocation

public String getLocation()
如果重定向产生错误,则返回 Location 头字段的值。

返回:
位置字符串

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策