public class TestRestTemplate extends RestTemplate
RestTemplate
that is suitable for integration tests.
They are fault tolerant, and optionally can carry Basic authentication headers. If
Apache Http Client 4.3.2 or better is available (recommended) it will be used as the
client, and by default configured to ignore cookies and redirects.Modifier and Type | Class and Description |
---|---|
protected static class |
TestRestTemplate.CustomHttpComponentsClientHttpRequestFactory |
static class |
TestRestTemplate.HttpClientOption
Options used to customize the Apache Http Client if it is used.
|
logger
Constructor and Description |
---|
TestRestTemplate(String username,
String password,
TestRestTemplate.HttpClientOption... httpClientOptions)
Create a new
TestRestTemplate instance with the specified credentials. |
TestRestTemplate(TestRestTemplate.HttpClientOption... httpClientOptions)
Create a new
TestRestTemplate instance. |
acceptHeaderRequestCallback, delete, delete, delete, doExecute, exchange, exchange, exchange, exchange, exchange, exchange, exchange, exchange, execute, execute, execute, getErrorHandler, getForEntity, getForEntity, getForEntity, getForObject, getForObject, getForObject, getMessageConverters, handleResponse, headersExtractor, headForHeaders, headForHeaders, headForHeaders, httpEntityCallback, httpEntityCallback, optionsForAllow, optionsForAllow, optionsForAllow, postForEntity, postForEntity, postForEntity, postForLocation, postForLocation, postForLocation, postForObject, postForObject, postForObject, put, put, put, responseEntityExtractor, setErrorHandler, setMessageConverters
getInterceptors, getRequestFactory, setInterceptors
createRequest, setRequestFactory
public TestRestTemplate(TestRestTemplate.HttpClientOption... httpClientOptions)
TestRestTemplate
instance.httpClientOptions
- client options to use if the Apache HTTP Client is usedpublic TestRestTemplate(String username, String password, TestRestTemplate.HttpClientOption... httpClientOptions)
TestRestTemplate
instance with the specified credentials.username
- the username to use (or null
)password
- the password (or null
)httpClientOptions
- client options to use if the Apache HTTP Client is usedCopyright © 2015 Pivotal Software, Inc.. All rights reserved.