Package com.qiniu.http
Class Response
- java.lang.Object
-
- com.qiniu.http.Response
-
public final class Response extends java.lang.Object定义HTTP请求的日志信息和常规方法
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResponse.ErrorBody
-
Field Summary
Fields Modifier and Type Field Description java.lang.Stringaddress服务器IPstatic intCancelleddoubleduration请求消耗时间,单位秒java.lang.Stringerror错误信息static intInvalidArgumentstatic intInvalidFilejava.lang.Stringmethod请求方法static intNetworkErrorjava.lang.StringreqId七牛日志扩展头intstatusCode回复状态码java.lang.Stringxlog七牛日志扩展头java.lang.Stringxviacdn日志扩展头
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]body()java.io.InputStreambodyStream()java.lang.StringbodyString()voidclose()java.lang.StringcontentType()static Responsecreate(okhttp3.Response response, java.lang.String address, double duration)static ResponsecreateError(okhttp3.Response response, java.lang.String address, double duration, java.lang.String error)static ResponsecreateSuccessResponse()java.lang.StringgetInfo()java.lang.Stringheader(java.lang.String name, java.lang.String defaultValue)booleanisContextExpiredError()booleanisJson()booleanisNetworkBroken()booleanisOK()booleanisServerError()StringMapjsonToMap()<T> TjsonToObject(java.lang.Class<T> classOfT)booleanneedRetry()booleanneedSwitchServer()java.lang.StringtoString()java.lang.Stringurl()
-
-
-
Field Detail
-
InvalidArgument
public static final int InvalidArgument
- See Also:
- Constant Field Values
-
InvalidFile
public static final int InvalidFile
- See Also:
- Constant Field Values
-
Cancelled
public static final int Cancelled
- See Also:
- Constant Field Values
-
NetworkError
public static final int NetworkError
- See Also:
- Constant Field Values
-
method
public final java.lang.String method
请求方法
-
statusCode
public final int statusCode
回复状态码
-
reqId
public final java.lang.String reqId
七牛日志扩展头
-
xlog
public final java.lang.String xlog
七牛日志扩展头
-
xvia
public final java.lang.String xvia
cdn日志扩展头
-
error
public final java.lang.String error
错误信息
-
duration
public final double duration
请求消耗时间,单位秒
-
address
public final java.lang.String address
服务器IP
-
-
Method Detail
-
create
public static Response create(okhttp3.Response response, java.lang.String address, double duration)
-
createError
public static Response createError(okhttp3.Response response, java.lang.String address, double duration, java.lang.String error)
-
createSuccessResponse
public static Response createSuccessResponse()
-
isOK
public boolean isOK()
-
isNetworkBroken
public boolean isNetworkBroken()
-
isServerError
public boolean isServerError()
-
isContextExpiredError
public boolean isContextExpiredError()
-
needSwitchServer
public boolean needSwitchServer()
-
needRetry
public boolean needRetry()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
jsonToObject
public <T> T jsonToObject(java.lang.Class<T> classOfT) throws QiniuException- Throws:
QiniuException
-
jsonToMap
public StringMap jsonToMap() throws QiniuException
- Throws:
QiniuException
-
body
public byte[] body() throws QiniuException- Throws:
QiniuException
-
bodyString
public java.lang.String bodyString() throws QiniuException- Throws:
QiniuException
-
bodyStream
public java.io.InputStream bodyStream() throws QiniuException- Throws:
QiniuException
-
close
public void close()
-
contentType
public java.lang.String contentType()
-
header
public java.lang.String header(java.lang.String name, java.lang.String defaultValue)
-
isJson
public boolean isJson()
-
url
public java.lang.String url()
-
getInfo
public java.lang.String getInfo()
-
-