|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.api.client.http.LowLevelHttpResponse
com.google.api.client.testing.http.MockLowLevelHttpResponse
public class MockLowLevelHttpResponse
Mock for LowLevelHttpResponse
.
Implementation is not thread-safe.
Field Summary | |
---|---|
InputStream |
content
Deprecated. (scheduled to be made private in 1.6) Use getContent() or
setContent(java.lang.String) |
String |
contentType
Deprecated. (scheduled to be made private in 1.6) Use getContentType() or
setContentType(java.lang.String) |
ArrayList<String> |
headerNames
Deprecated. (scheduled to be made private in 1.6) Use getHeaderNames() or
setHeaderNames(java.util.ArrayList |
ArrayList<String> |
headerValues
Deprecated. (scheduled to be made private in 1.6) Use getHeaderValues() or
setHeaderValues(java.util.ArrayList |
int |
statusCode
Deprecated. (scheduled to be made private in 1.6) Use getStatusCode() or
setStatusCode(int) |
Constructor Summary | |
---|---|
MockLowLevelHttpResponse()
|
Method Summary | |
---|---|
void |
addHeader(String name,
String value)
Adds a header to the response. |
InputStream |
getContent()
Returns the HTTP response content input stream or null for none. |
String |
getContentEncoding()
Returns the content encoding (for example "gzip" ) or null for none. |
long |
getContentLength()
Returns the content length or 0 for none. |
String |
getContentType()
Returns the content type or null for none. |
int |
getHeaderCount()
Returns the number of HTTP response headers. |
String |
getHeaderName(int index)
Returns the HTTP response header name at the given zero-based index. |
List<String> |
getHeaderNames()
Returns the list of header names of HTTP response. |
String |
getHeaderValue(int index)
Returns the HTTP response header value at the given zero-based index. |
List<String> |
getHeaderValues()
Returns the list of header values of HTTP response. |
String |
getReasonPhrase()
Returns the HTTP reason phrase or null for none. |
int |
getStatusCode()
Returns the response status code or 0 for none. |
String |
getStatusLine()
Returns the response status line or null for none. |
MockLowLevelHttpResponse |
setContent(InputStream content)
Sets the input stream content of HTTP response or null for none. |
MockLowLevelHttpResponse |
setContent(String stringContent)
Sets the response content to the given content string. |
MockLowLevelHttpResponse |
setContentEncoding(String contentEncoding)
Sets the content encoding or null for none. |
MockLowLevelHttpResponse |
setContentLength(long contentLength)
Sets the content length or 0 for none. |
MockLowLevelHttpResponse |
setContentType(String contentType)
Sets the content type of HTTP response or null for none. |
MockLowLevelHttpResponse |
setHeaderNames(ArrayList<String> headerNames)
Sets the list of header names of HTTP response. |
MockLowLevelHttpResponse |
setHeaderValues(ArrayList<String> headerValues)
Sets the list of header values of HTTP response. |
MockLowLevelHttpResponse |
setStatusCode(int statusCode)
Sets the status code of HTTP response. |
Methods inherited from class com.google.api.client.http.LowLevelHttpResponse |
---|
disconnect |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Deprecated public InputStream content
getContent()
or
setContent(java.lang.String)
null
by default.
@Deprecated public String contentType
getContentType()
or
setContentType(java.lang.String)
null
by default.
@Deprecated public int statusCode
getStatusCode()
or
setStatusCode(int)
200
by default.
@Deprecated public ArrayList<String> headerNames
getHeaderNames()
or
setHeaderNames(java.util.ArrayList)
@Deprecated public ArrayList<String> headerValues
getHeaderValues()
or
setHeaderValues(java.util.ArrayList)
Constructor Detail |
---|
public MockLowLevelHttpResponse()
Method Detail |
---|
public void addHeader(String name, String value)
name
- header namevalue
- header valuepublic MockLowLevelHttpResponse setContent(String stringContent)
stringContent
- content stringpublic InputStream getContent() throws IOException
LowLevelHttpResponse
null
for none.
getContent
in class LowLevelHttpResponse
IOException
- I/O exceptionpublic String getContentEncoding()
LowLevelHttpResponse
"gzip"
) or null
for none.
getContentEncoding
in class LowLevelHttpResponse
public long getContentLength()
LowLevelHttpResponse
0
for none.
getContentLength
in class LowLevelHttpResponse
public final String getContentType()
LowLevelHttpResponse
null
for none.
getContentType
in class LowLevelHttpResponse
public int getHeaderCount()
LowLevelHttpResponse
Note that multiple headers of the same name need to be supported, in which case each header value is treated as a separate header.
getHeaderCount
in class LowLevelHttpResponse
public String getHeaderName(int index)
LowLevelHttpResponse
getHeaderName
in class LowLevelHttpResponse
public String getHeaderValue(int index)
LowLevelHttpResponse
getHeaderValue
in class LowLevelHttpResponse
public String getReasonPhrase()
LowLevelHttpResponse
null
for none.
getReasonPhrase
in class LowLevelHttpResponse
public int getStatusCode()
LowLevelHttpResponse
0
for none.
getStatusCode
in class LowLevelHttpResponse
public String getStatusLine()
LowLevelHttpResponse
null
for none.
getStatusLine
in class LowLevelHttpResponse
public final List<String> getHeaderNames()
public MockLowLevelHttpResponse setHeaderNames(ArrayList<String> headerNames)
Default value is an empty list.
public final List<String> getHeaderValues()
Default value is an empty list.
public MockLowLevelHttpResponse setHeaderValues(ArrayList<String> headerValues)
public MockLowLevelHttpResponse setContent(InputStream content)
null
for none.
public MockLowLevelHttpResponse setContentType(String contentType)
null
for none.
public MockLowLevelHttpResponse setContentEncoding(String contentEncoding)
null
for none.
public MockLowLevelHttpResponse setContentLength(long contentLength)
0
for none.
public MockLowLevelHttpResponse setStatusCode(int statusCode)
Default value is 200
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |