Class ApacheHttpResponse
- java.lang.Object
-
- com.google.api.client.http.LowLevelHttpResponse
-
- com.google.api.client.http.apache.ApacheHttpResponse
-
final class ApacheHttpResponse extends LowLevelHttpResponse
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.http.Header[]
allHeaders
private org.apache.http.client.methods.HttpRequestBase
request
private org.apache.http.HttpResponse
response
-
Constructor Summary
Constructors Constructor Description ApacheHttpResponse(org.apache.http.client.methods.HttpRequestBase request, org.apache.http.HttpResponse response)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disconnect()
Aborts execution of the request.java.io.InputStream
getContent()
Returns the HTTP response content input stream ornull
for none.java.lang.String
getContentEncoding()
Returns the content encoding (for example"gzip"
) ornull
for none.long
getContentLength()
Returns the content length or0
for none.java.lang.String
getContentType()
Returns the content type ornull
for none.int
getHeaderCount()
Returns the number of HTTP response headers.java.lang.String
getHeaderName(int index)
Returns the HTTP response header name at the given zero-based index.java.lang.String
getHeaderValue(int index)
Returns the HTTP response header value at the given zero-based index.java.lang.String
getHeaderValue(java.lang.String name)
java.lang.String
getReasonPhrase()
Returns the HTTP reason phrase ornull
for none.int
getStatusCode()
Returns the response status code or<=0
for none.java.lang.String
getStatusLine()
Returns the response status line ornull
for none.
-
-
-
Method Detail
-
getStatusCode
public int getStatusCode()
Description copied from class:LowLevelHttpResponse
Returns the response status code or<=0
for none.- Specified by:
getStatusCode
in classLowLevelHttpResponse
-
getContent
public java.io.InputStream getContent() throws java.io.IOException
Description copied from class:LowLevelHttpResponse
Returns the HTTP response content input stream ornull
for none.- Specified by:
getContent
in classLowLevelHttpResponse
- Throws:
java.io.IOException
- I/O exception
-
getContentEncoding
public java.lang.String getContentEncoding()
Description copied from class:LowLevelHttpResponse
Returns the content encoding (for example"gzip"
) ornull
for none.- Specified by:
getContentEncoding
in classLowLevelHttpResponse
-
getContentLength
public long getContentLength()
Description copied from class:LowLevelHttpResponse
Returns the content length or0
for none.- Specified by:
getContentLength
in classLowLevelHttpResponse
-
getContentType
public java.lang.String getContentType()
Description copied from class:LowLevelHttpResponse
Returns the content type ornull
for none.- Specified by:
getContentType
in classLowLevelHttpResponse
-
getReasonPhrase
public java.lang.String getReasonPhrase()
Description copied from class:LowLevelHttpResponse
Returns the HTTP reason phrase ornull
for none.- Specified by:
getReasonPhrase
in classLowLevelHttpResponse
-
getStatusLine
public java.lang.String getStatusLine()
Description copied from class:LowLevelHttpResponse
Returns the response status line ornull
for none.- Specified by:
getStatusLine
in classLowLevelHttpResponse
-
getHeaderValue
public java.lang.String getHeaderValue(java.lang.String name)
-
getHeaderCount
public int getHeaderCount()
Description copied from class:LowLevelHttpResponse
Returns the number of HTTP response headers.Note that multiple headers of the same name need to be supported, in which case each header value is treated as a separate header.
- Specified by:
getHeaderCount
in classLowLevelHttpResponse
-
getHeaderName
public java.lang.String getHeaderName(int index)
Description copied from class:LowLevelHttpResponse
Returns the HTTP response header name at the given zero-based index.- Specified by:
getHeaderName
in classLowLevelHttpResponse
-
getHeaderValue
public java.lang.String getHeaderValue(int index)
Description copied from class:LowLevelHttpResponse
Returns the HTTP response header value at the given zero-based index.- Specified by:
getHeaderValue
in classLowLevelHttpResponse
-
disconnect
public void disconnect()
Aborts execution of the request.- Overrides:
disconnect
in classLowLevelHttpResponse
- Since:
- 1.4
-
-