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

com.yuweix.kuafu.http.DefaultHttpRequestInterceptor Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package com.yuweix.kuafu.http;


import java.io.IOException;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.protocol.HttpContext;


/**
 * HTTP请求过滤器,在执行请求之前拦截HttpRequest和 HttpContext;
 * @author yuwei
 */
public class DefaultHttpRequestInterceptor implements HttpRequestInterceptor {
	private static volatile DefaultHttpRequestInterceptor instance = null;
	private static final Lock lock = new ReentrantLock();

	private DefaultHttpRequestInterceptor() {
		
	}

	public static DefaultHttpRequestInterceptor get() {
		if (instance == null) {
			lock.lock();
			try {
				if (instance == null) {
					instance = new DefaultHttpRequestInterceptor();
				}
			} finally {
				lock.unlock();
			}
		}
		
		return instance;
	}


	@Override
	public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
		
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy