Search in sources :

Example 16 with RequestCallback

use of org.springframework.web.client.RequestCallback in project java-chassis by ServiceComb.

the class CseRestTemplate method patchForObject.

// PUT
// no override
// PATCH
@Override
@Nullable
public <T> T patchForObject(String url, @Nullable Object request, Class<T> responseType, Object... uriVariables) throws RestClientException {
    RequestCallback requestCallback = httpEntityCallback(request, responseType);
    CseHttpMessageConverterExtractor<T> responseExtractor = new CseHttpMessageConverterExtractor<>();
    return execute(url, HttpMethod.PATCH, requestCallback, responseExtractor, uriVariables);
}
Also used : RequestCallback(org.springframework.web.client.RequestCallback) Nullable(org.springframework.lang.Nullable)

Example 17 with RequestCallback

use of org.springframework.web.client.RequestCallback in project java-chassis by ServiceComb.

the class CseRestTemplate method patchForObject.

@Override
@Nullable
public <T> T patchForObject(String url, @Nullable Object request, Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
    RequestCallback requestCallback = httpEntityCallback(request, responseType);
    CseHttpMessageConverterExtractor<T> responseExtractor = new CseHttpMessageConverterExtractor<>();
    return execute(url, HttpMethod.PATCH, requestCallback, responseExtractor, uriVariables);
}
Also used : RequestCallback(org.springframework.web.client.RequestCallback) Nullable(org.springframework.lang.Nullable)

Example 18 with RequestCallback

use of org.springframework.web.client.RequestCallback in project java-chassis by ServiceComb.

the class CseRestTemplate method postForObject.

@Override
@Nullable
public <T> T postForObject(URI url, @Nullable Object request, Class<T> responseType) throws RestClientException {
    RequestCallback requestCallback = httpEntityCallback(request, responseType);
    CseHttpMessageConverterExtractor<T> responseExtractor = new CseHttpMessageConverterExtractor<>();
    return execute(url, HttpMethod.POST, requestCallback, responseExtractor);
}
Also used : RequestCallback(org.springframework.web.client.RequestCallback) Nullable(org.springframework.lang.Nullable)

Example 19 with RequestCallback

use of org.springframework.web.client.RequestCallback in project java-chassis by ServiceComb.

the class CseRestTemplate method postForObject.

@Override
@Nullable
public <T> T postForObject(String url, @Nullable Object request, Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
    RequestCallback requestCallback = httpEntityCallback(request, responseType);
    CseHttpMessageConverterExtractor<T> responseExtractor = new CseHttpMessageConverterExtractor<>();
    return execute(url, HttpMethod.POST, requestCallback, responseExtractor, uriVariables);
}
Also used : RequestCallback(org.springframework.web.client.RequestCallback) Nullable(org.springframework.lang.Nullable)

Example 20 with RequestCallback

use of org.springframework.web.client.RequestCallback in project java-chassis by ServiceComb.

the class CseRestTemplate method getForObject.

@Override
@Nullable
public <T> T getForObject(URI url, Class<T> responseType) throws RestClientException {
    RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
    CseHttpMessageConverterExtractor<T> responseExtractor = new CseHttpMessageConverterExtractor<>();
    return execute(url, HttpMethod.GET, requestCallback, responseExtractor);
}
Also used : RequestCallback(org.springframework.web.client.RequestCallback) Nullable(org.springframework.lang.Nullable)

Aggregations

RequestCallback (org.springframework.web.client.RequestCallback)24 Nullable (org.springframework.lang.Nullable)9 HttpHeaders (org.springframework.http.HttpHeaders)7 RestTemplate (org.springframework.web.client.RestTemplate)7 IOException (java.io.IOException)6 ResponseEntity (org.springframework.http.ResponseEntity)5 URI (java.net.URI)4 Date (java.util.Date)4 List (java.util.List)4 ClientHttpRequest (org.springframework.http.client.ClientHttpRequest)4 Map (java.util.Map)3 Set (java.util.Set)3 Test (org.junit.Test)3 MediaType (org.springframework.http.MediaType)3 ResponseErrorHandler (org.springframework.web.client.ResponseErrorHandler)3 ResponseExtractor (org.springframework.web.client.ResponseExtractor)3 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)2 Randomness.uniquify (com.seanyinx.github.unit.scaffolding.Randomness.uniquify)2 Arrays.asList (java.util.Arrays.asList)2 Collections.singletonList (java.util.Collections.singletonList)2