View Javadoc
1   package com.foxinmy.weixin4j.http;
2   
3   import java.util.Set;
4   
5   import com.foxinmy.weixin4j.http.entity.HttpEntity;
6   
7   /**
8    * HTTP 接口
9    * 
10   * @className HttpClient
11   * @author jinyu(foxinmy@gmail.com)
12   * @date 2015年5月30日
13   * @since JDK 1.6
14   * @see
15   */
16  public interface HttpClient {
17  
18  	// get
19  	HttpResponse get(String url) throws HttpClientException;
20  
21  	HttpResponse get(String url, URLParameter... parameters)
22  			throws HttpClientException;
23  
24  	// head
25  	HttpHeaders head(String url) throws HttpClientException;
26  
27  	HttpHeaders head(String url, URLParameter... parameters)
28  			throws HttpClientException;
29  
30  	// post
31  	HttpResponse post(String url) throws HttpClientException;
32  
33  	HttpResponse post(String url, URLParameter... parameters)
34  			throws HttpClientException;
35  
36  	HttpResponse post(String url, HttpEntity httpEntity)
37  			throws HttpClientException;
38  
39  	// put
40  	void put(String url) throws HttpClientException;
41  
42  	void put(String url, URLParameter... parameters) throws HttpClientException;
43  
44  	// delete
45  	void delete(String url) throws HttpClientException;
46  
47  	void delete(String url, URLParameter... parameters)
48  			throws HttpClientException;
49  
50  	// OPTIONS
51  	Set<HttpMethod> options(String url) throws HttpClientException;
52  
53  	Set<HttpMethod> options(String url, URLParameter... parameters)
54  			throws HttpClientException;
55  
56  	/**
57  	 * 处理请求
58  	 * 
59  	 * @param request
60  	 *            请求对象
61  	 * @return 响应对象
62  	 * @throws HttpClientException
63  	 */
64  	HttpResponse execute(HttpRequest request) throws HttpClientException;
65  }