All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yelong.http.client.AbstractHttpClient Maven / Gradle / Ivy

Go to download

简单封装java对http的请求,实现便捷的发送http请求(可以发送携带文件的请求)

The newest version!
package org.yelong.http.client;

import java.util.ArrayList;
import java.util.List;

import org.yelong.http.request.HttpRequestInterceptor;
import org.yelong.http.response.HttpResponseInterceptor;

/**
 * 抽象的http 客户端实现
 * 
 * @since 1.0
 */
public abstract class AbstractHttpClient implements HttpClient {

	private final List httpRequestInterceptors = new ArrayList<>();

	private final List httpResponseInterceptors = new ArrayList<>();

	@Override
	public void addHttpRequestInterceptor(HttpRequestInterceptor httpRequestInterceptor) {
		this.httpRequestInterceptors.add(httpRequestInterceptor);
	}

	@Override
	public void removeHttpRequestInterceptor(HttpRequestInterceptor httpRequestInterceptor) {
		this.httpRequestInterceptors.remove(httpRequestInterceptor);
	}

	@Override
	public List getHttpRequestInterceptors() {
		return this.httpRequestInterceptors;
	}

	@Override
	public void addHttpResponseInterceptor(HttpResponseInterceptor HttpResponseInterceptor) {
		this.httpResponseInterceptors.add(HttpResponseInterceptor);
	}

	@Override
	public void removeHttpResponseInterceptor(HttpResponseInterceptor HttpResponseInterceptor) {
		this.httpResponseInterceptors.remove(HttpResponseInterceptor);
	}

	@Override
	public List getHttpResponseInterceptors() {
		return this.httpResponseInterceptors;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy