/** * Create a new instance of the {@code AsyncRestTemplate} using the given * {@link org.springframework.http.client.AsyncClientHttpRequestFactory} and synchronous {@link RestTemplate}. * @param requestFactory the asynchronous request factory to use * @param restTemplate the synchronous template to use */ public AsyncRestTemplate(org.springframework.http.client.AsyncClientHttpRequestFactory requestFactory, RestTemplate restTemplate) { Assert.notNull(restTemplate, "RestTemplate must not be null"); this.syncTemplate = restTemplate; setAsyncRequestFactory(requestFactory); }
/** * Create a new instance of the {@code AsyncRestTemplate} using the given * {@link org.springframework.http.client.AsyncClientHttpRequestFactory} and synchronous {@link RestTemplate}. * @param requestFactory the asynchronous request factory to use * @param restTemplate the synchronous template to use */ public AsyncRestTemplate(org.springframework.http.client.AsyncClientHttpRequestFactory requestFactory, RestTemplate restTemplate) { Assert.notNull(restTemplate, "RestTemplate must not be null"); this.syncTemplate = restTemplate; setAsyncRequestFactory(requestFactory); }
/** * Create a new instance of the {@code AsyncRestTemplate} using the given * {@link AsyncTaskExecutor}. * <p>This constructor uses a {@link SimpleClientHttpRequestFactory} in combination * with the given {@code AsyncTaskExecutor} for asynchronous execution. */ public AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor) { Assert.notNull(taskExecutor, "AsyncTaskExecutor must not be null"); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setTaskExecutor(taskExecutor); this.syncTemplate = new RestTemplate(requestFactory); setAsyncRequestFactory(requestFactory); }
/** * Create a new instance of the {@code AsyncRestTemplate} using the given * {@link AsyncTaskExecutor}. * <p>This constructor uses a {@link SimpleClientHttpRequestFactory} in combination * with the given {@code AsyncTaskExecutor} for asynchronous execution. */ public AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor) { Assert.notNull(taskExecutor, "AsyncTaskExecutor must not be null"); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setTaskExecutor(taskExecutor); this.syncTemplate = new RestTemplate(requestFactory); setAsyncRequestFactory(requestFactory); }
@Override public MockRestServiceServer build(RequestExpectationManager manager) { MockRestServiceServer server = new MockRestServiceServer(manager); MockClientHttpRequestFactory factory = server.new MockClientHttpRequestFactory(); if (this.restTemplate != null) { if (this.bufferContent) { this.restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory)); } else { this.restTemplate.setRequestFactory(factory); } } if (this.asyncRestTemplate != null) { this.asyncRestTemplate.setAsyncRequestFactory(factory); } return server; } }
/** * Create a new instance of the {@code AsyncRestTemplate} using the given * {@link org.springframework.http.client.AsyncClientHttpRequestFactory} and synchronous {@link RestTemplate}. * @param requestFactory the asynchronous request factory to use * @param restTemplate the synchronous template to use */ public AsyncRestTemplate(org.springframework.http.client.AsyncClientHttpRequestFactory requestFactory, RestTemplate restTemplate) { Assert.notNull(restTemplate, "RestTemplate must not be null"); this.syncTemplate = restTemplate; setAsyncRequestFactory(requestFactory); }
/** * Create a new instance of the {@code AsyncRestTemplate} using the given * {@link org.springframework.http.client.AsyncClientHttpRequestFactory} and synchronous {@link RestTemplate}. * @param requestFactory the asynchronous request factory to use * @param restTemplate the synchronous template to use */ public AsyncRestTemplate(org.springframework.http.client.AsyncClientHttpRequestFactory requestFactory, RestTemplate restTemplate) { Assert.notNull(restTemplate, "RestTemplate must not be null"); this.syncTemplate = restTemplate; setAsyncRequestFactory(requestFactory); }
/** * Create a new instance of the {@code AsyncRestTemplate} using the given * {@link AsyncTaskExecutor}. * <p>This constructor uses a {@link SimpleClientHttpRequestFactory} in combination * with the given {@code AsyncTaskExecutor} for asynchronous execution. */ public AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor) { Assert.notNull(taskExecutor, "AsyncTaskExecutor must not be null"); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setTaskExecutor(taskExecutor); this.syncTemplate = new RestTemplate(requestFactory); setAsyncRequestFactory(requestFactory); }
/** * Create a new instance of the {@code AsyncRestTemplate} using the given * {@link AsyncTaskExecutor}. * <p>This constructor uses a {@link SimpleClientHttpRequestFactory} in combination * with the given {@code AsyncTaskExecutor} for asynchronous execution. */ public AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor) { Assert.notNull(taskExecutor, "AsyncTaskExecutor must not be null"); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setTaskExecutor(taskExecutor); this.syncTemplate = new RestTemplate(requestFactory); setAsyncRequestFactory(requestFactory); }
@Override public MockRestServiceServer build(RequestExpectationManager manager) { MockRestServiceServer server = new MockRestServiceServer(manager); MockClientHttpRequestFactory factory = server.new MockClientHttpRequestFactory(); if (this.restTemplate != null) { this.restTemplate.setRequestFactory(factory); } if (this.asyncRestTemplate != null) { this.asyncRestTemplate.setAsyncRequestFactory(factory); } return server; } }
@Override public MockRestServiceServer build(RequestExpectationManager manager) { MockRestServiceServer server = new MockRestServiceServer(manager); MockClientHttpRequestFactory factory = server.new MockClientHttpRequestFactory(); if (this.restTemplate != null) { if (this.bufferContent) { this.restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory)); } else { this.restTemplate.setRequestFactory(factory); } } if (this.asyncRestTemplate != null) { this.asyncRestTemplate.setAsyncRequestFactory(factory); } return server; } }