|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.api.client.http.HttpTransport
com.google.api.client.testing.http.MockHttpTransport
public class MockHttpTransport
Mock for HttpTransport
.
Implementation is thread-safe, as long as supportedOptionalMethods
is not modified
directly (which is deprecated usage). For maximum efficiency, applications should use a single
globally-shared instance of the HTTP transport.
Nested Class Summary | |
---|---|
static class |
MockHttpTransport.Builder
Builder for MockHttpTransport . |
Field Summary | |
---|---|
static Set<HttpMethod> |
DEFAULT_SUPPORTED_OPTIONAL_METHODS
Default supported optional methods. |
EnumSet<HttpMethod> |
supportedOptionalMethods
Deprecated. (scheduled to be made private in 1.6) Use getSupportedOptionalMethods() or
MockHttpTransport.Builder.setSupportedOptionalMethods(java.util.Set |
Constructor Summary | |
---|---|
|
MockHttpTransport()
|
protected |
MockHttpTransport(Set<HttpMethod> supportedOptionalMethods)
|
Method Summary | |
---|---|
LowLevelHttpRequest |
buildDeleteRequest(String url)
Builds a DELETE request. |
static MockHttpTransport.Builder |
builder()
Returns an instance of a new builder. |
LowLevelHttpRequest |
buildGetRequest(String url)
Builds a GET request. |
LowLevelHttpRequest |
buildHeadRequest(String url)
Builds a HEAD request. |
LowLevelHttpRequest |
buildPatchRequest(String url)
Builds a PATCH request. |
LowLevelHttpRequest |
buildPostRequest(String url)
Builds a POST request. |
LowLevelHttpRequest |
buildPutRequest(String url)
Builds a PUT request. |
Set<HttpMethod> |
getSupportedOptionalMethods()
Returns the set of supported optional methods. |
void |
setSupportedOptionalMethods(EnumSet<HttpMethod> supportedOptionalMethods)
|
boolean |
supportsHead()
Returns whether this HTTP transport implementation supports the HEAD request method. |
boolean |
supportsPatch()
Returns whether this HTTP transport implementation supports the PATCH request method. |
Methods inherited from class com.google.api.client.http.HttpTransport |
---|
createRequestFactory, createRequestFactory, shutdown |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Set<HttpMethod> DEFAULT_SUPPORTED_OPTIONAL_METHODS
@Deprecated public EnumSet<HttpMethod> supportedOptionalMethods
getSupportedOptionalMethods()
or
MockHttpTransport.Builder.setSupportedOptionalMethods(java.util.Set)
HttpMethod.HEAD
and HttpMethod.PATCH
by
default.
Constructor Detail |
---|
public MockHttpTransport()
protected MockHttpTransport(Set<HttpMethod> supportedOptionalMethods)
supportedOptionalMethods
- set of supported optional methodsMethod Detail |
---|
public final Set<HttpMethod> getSupportedOptionalMethods()
Default value is DEFAULT_SUPPORTED_OPTIONAL_METHODS
.
public void setSupportedOptionalMethods(EnumSet<HttpMethod> supportedOptionalMethods)
supportedOptionalMethods
- the supportedOptionalMethods to setpublic LowLevelHttpRequest buildDeleteRequest(String url) throws IOException
HttpTransport
DELETE
request.
buildDeleteRequest
in class HttpTransport
url
- URL
IOException
- I/O exceptionpublic LowLevelHttpRequest buildGetRequest(String url) throws IOException
HttpTransport
GET
request.
buildGetRequest
in class HttpTransport
url
- URL
IOException
- I/O exceptionpublic LowLevelHttpRequest buildHeadRequest(String url) throws IOException
HttpTransport
HEAD
request. Won't be called if HttpTransport.supportsHead()
returns false
.
Default implementation throws an UnsupportedOperationException
.
buildHeadRequest
in class HttpTransport
url
- URL
IOException
- I/O exceptionpublic LowLevelHttpRequest buildPatchRequest(String url) throws IOException
HttpTransport
PATCH
request. Won't be called if HttpTransport.supportsPatch()
returns false
.
Default implementation throws an UnsupportedOperationException
.
buildPatchRequest
in class HttpTransport
url
- URL
IOException
- I/O exceptionpublic LowLevelHttpRequest buildPostRequest(String url) throws IOException
HttpTransport
POST
request.
buildPostRequest
in class HttpTransport
url
- URL
IOException
- I/O exceptionpublic LowLevelHttpRequest buildPutRequest(String url) throws IOException
HttpTransport
PUT
request.
buildPutRequest
in class HttpTransport
url
- URL
IOException
- I/O exceptionpublic boolean supportsHead()
HttpTransport
HEAD
request method.
Default implementation returns false
.
supportsHead
in class HttpTransport
public boolean supportsPatch()
HttpTransport
PATCH
request method.
Default implementation returns false
.
supportsPatch
in class HttpTransport
public static MockHttpTransport.Builder builder()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |