001/* 002 * Copyright 2002-2016 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.http.client; 018 019import java.io.IOException; 020 021import org.springframework.http.HttpRequest; 022import org.springframework.util.concurrent.ListenableFuture; 023 024/** 025 * Represents the context of a client-side HTTP request execution. 026 * 027 * <p>Used to invoke the next interceptor in the interceptor chain, or - 028 * if the calling interceptor is last - execute the request itself. 029 * 030 * @author Jakub Narloch 031 * @author Rossen Stoyanchev 032 * @since 4.3 033 * @see AsyncClientHttpRequestInterceptor 034 */ 035public interface AsyncClientHttpRequestExecution { 036 037 /** 038 * Resume the request execution by invoking the next interceptor in the chain 039 * or executing the request to the remote service. 040 * @param request the HTTP request, containing the HTTP method and headers 041 * @param body the body of the request 042 * @return a corresponding future handle 043 * @throws IOException in case of I/O errors 044 */ 045 ListenableFuture<ClientHttpResponse> executeAsync(HttpRequest request, byte[] body) throws IOException; 046 047}