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 class
Response.ErrorBody
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
address
服务器IPstatic int
Cancelled
double
duration
请求消耗时间,单位秒java.lang.String
error
错误信息static int
InvalidArgument
static int
InvalidFile
java.lang.String
method
请求方法static int
NetworkError
java.lang.String
reqId
七牛日志扩展头int
statusCode
回复状态码java.lang.String
xlog
七牛日志扩展头java.lang.String
xvia
cdn日志扩展头
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
body()
java.io.InputStream
bodyStream()
java.lang.String
bodyString()
void
close()
java.lang.String
contentType()
static Response
create(okhttp3.Response response, java.lang.String address, double duration)
static Response
createError(okhttp3.Response response, java.lang.String address, double duration, java.lang.String error)
static Response
createSuccessResponse()
java.lang.String
getInfo()
java.lang.String
header(java.lang.String name, java.lang.String defaultValue)
boolean
isContextExpiredError()
boolean
isJson()
boolean
isNetworkBroken()
boolean
isOK()
boolean
isServerError()
StringMap
jsonToMap()
<T> T
jsonToObject(java.lang.Class<T> classOfT)
boolean
needRetry()
boolean
needSwitchServer()
java.lang.String
toString()
java.lang.String
url()
-
-
-
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:
toString
in 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()
-
-