Skip to content

Commit b5a50a5

Browse files
author
崔成龙
committed
完善发布maven仓库所需配置及注释
1 parent fec8aa4 commit b5a50a5

File tree

15 files changed

+306
-246
lines changed

15 files changed

+306
-246
lines changed

pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,33 @@
6262
<groupId>org.apache.maven.plugins</groupId>
6363
<artifactId>maven-javadoc-plugin</artifactId>
6464
<version>${maven-javadoc-plugin.version}</version>
65+
<executions>
66+
<execution>
67+
<id>attach-javadocs</id>
68+
<goals>
69+
<goal>jar</goal>
70+
</goals>
71+
</execution>
72+
</executions>
73+
<configuration>
74+
<aggregate>true</aggregate>
75+
<charset>${project.build.sourceEncoding}</charset>
76+
<encoding>${project.build.sourceEncoding}</encoding>
77+
<docencoding>${project.build.sourceEncoding}</docencoding>
78+
</configuration>
6579
</plugin>
6680
<plugin>
6781
<groupId>org.apache.maven.plugins</groupId>
6882
<artifactId>maven-source-plugin</artifactId>
6983
<version>${maven-source-plugin.version}</version>
84+
<executions>
85+
<execution>
86+
<id>attach-sources</id>
87+
<goals>
88+
<goal>jar</goal>
89+
</goals>
90+
</execution>
91+
</executions>
7092
</plugin>
7193
<plugin>
7294
<groupId>org.apache.maven.plugins</groupId>

src/main/java/com/arronlong/httpclientutil/HttpClientUtil.java

Lines changed: 97 additions & 98 deletions
Large diffs are not rendered by default.

src/main/java/com/arronlong/httpclientutil/builder/HCB.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
* httpclient创建者
3333
*
3434
* @author arron
35-
* @date 2015年11月9日 下午5:45:47
3635
* @version 1.0
3736
*/
3837
public class HCB extends HttpClientBuilder{
@@ -52,7 +51,7 @@ public static HCB custom(){
5251
* 设置超时时间
5352
*
5453
* @param timeout 超市时间,单位-毫秒
55-
* @return
54+
* @return 返回当前对象
5655
*/
5756
public HCB timeout(int timeout){
5857
return timeout(timeout, true);
@@ -63,7 +62,7 @@ public HCB timeout(int timeout){
6362
*
6463
* @param timeout 超时时间,单位-毫秒
6564
* @param redirectEnable 自动跳转
66-
* @return
65+
* @return 返回当前对象
6766
*/
6867
public HCB timeout(int timeout, boolean redirectEnable){
6968
// 配置请求的超时设置
@@ -79,8 +78,8 @@ public HCB timeout(int timeout, boolean redirectEnable){
7978
/**
8079
* 设置ssl安全链接
8180
*
82-
* @return
83-
* @throws HttpProcessException
81+
* @return 返回当前对象
82+
* @throws HttpProcessException http处理异常
8483
*/
8584
public HCB ssl() throws HttpProcessException {
8685
// if(isSetPool){//如果已经设置过线程池,那肯定也就是https链接了
@@ -104,8 +103,8 @@ public HCB ssl() throws HttpProcessException {
104103
* 设置自定义sslcontext
105104
*
106105
* @param keyStorePath 密钥库路径
107-
* @return
108-
* @throws HttpProcessException
106+
* @return 返回当前对象
107+
* @throws HttpProcessException http处理异常
109108
*/
110109
public HCB ssl(String keyStorePath) throws HttpProcessException{
111110
return ssl(keyStorePath,"nopassword");
@@ -115,8 +114,8 @@ public HCB ssl(String keyStorePath) throws HttpProcessException{
115114
*
116115
* @param keyStorePath 密钥库路径
117116
* @param keyStorepass 密钥库密码
118-
* @return
119-
* @throws HttpProcessException
117+
* @return 返回当前对象
118+
* @throws HttpProcessException http处理异常
120119
*/
121120
public HCB ssl(String keyStorePath, String keyStorepass) throws HttpProcessException{
122121
this.ssls = SSLs.custom().customSSL(keyStorePath, keyStorepass);
@@ -130,8 +129,8 @@ public HCB ssl(String keyStorePath, String keyStorepass) throws HttpProcessExcep
130129
*
131130
* @param maxTotal 最大连接数
132131
* @param defaultMaxPerRoute 每个路由默认连接数
133-
* @return
134-
* @throws HttpProcessException
132+
* @return 返回当前对象
133+
* @throws HttpProcessException http处理异常
135134
*/
136135
public HCB pool(int maxTotal, int defaultMaxPerRoute) throws HttpProcessException{
137136
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder
@@ -152,7 +151,7 @@ public HCB pool(int maxTotal, int defaultMaxPerRoute) throws HttpProcessExceptio
152151
*
153152
* @param hostOrIP 代理host或者ip
154153
* @param port 代理端口
155-
* @return
154+
* @return 返回当前对象
156155
*/
157156
public HCB proxy(String hostOrIP, int port){
158157
// 依次是代理地址,代理端口号,协议类型
@@ -165,7 +164,7 @@ public HCB proxy(String hostOrIP, int port){
165164
* 重试(如果请求是幂等的,就再次尝试)
166165
*
167166
* @param tryTimes 重试次数
168-
* @return
167+
* @return 返回当前对象
169168
*/
170169
public HCB retry(final int tryTimes){
171170
return retry(tryTimes, false);
@@ -176,7 +175,7 @@ public HCB retry(final int tryTimes){
176175
*
177176
* @param tryTimes 重试次数
178177
* @param retryWhenInterruptedIO 连接拒绝时,是否重试
179-
* @return
178+
* @return 返回当前对象
180179
*/
181180
public HCB retry(final int tryTimes, final boolean retryWhenInterruptedIO){
182181
// 请求重试处理
@@ -220,10 +219,10 @@ public boolean retryRequest(IOException exception, int executionCount, HttpConte
220219

221220
/**
222221
* 设置ssl版本<br>
223-
* 如果您想要设置ssl版本,必须<b><font color=red>先调用此方法,再调用ssl方法</font><br>
222+
* 如果您想要设置ssl版本,必须<b><span style="color:red">先调用此方法,再调用ssl方法</span><br>
224223
* 仅支持 SSLv3,TSLv1,TSLv1.1,TSLv1.2</b>
225-
* @param sslpv
226-
* @return
224+
* @param sslpv 版本号
225+
* @return 返回当前对象
227226
*/
228227
public HCB sslpv(String sslpv){
229228
return sslpv(SSLProtocolVersion.find(sslpv));
@@ -232,8 +231,8 @@ public HCB sslpv(String sslpv){
232231
* 设置ssl版本<br>
233232
* 如果您想要设置ssl版本,必须<b>先调用此方法,再调用ssl方法<br>
234233
* 仅支持 SSLv3,TSLv1,TSLv1.1,TSLv1.2</b>
235-
* @param sslpv
236-
* @return
234+
* @param sslpv 版本号
235+
* @return 返回当前对象
237236
*/
238237
public HCB sslpv(SSLProtocolVersion sslpv){
239238
this.sslpv = sslpv;

src/main/java/com/arronlong/httpclientutil/common/HttpConfig.java

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* 请求配置类
1717
*
1818
* @author arron
19-
* @date 2016年2月2日 下午3:14:32
2019
* @version 1.0
2120
*/
2221
public class HttpConfig {
@@ -25,7 +24,7 @@ public class HttpConfig {
2524

2625
/**
2726
* 获取实例
28-
* @return
27+
* @return 返回当前对象
2928
*/
3029
public static HttpConfig custom(){
3130
return new HttpConfig();
@@ -97,23 +96,26 @@ public static HttpConfig custom(){
9796
private static final ThreadLocal<String> urls = new ThreadLocal<String>();
9897

9998
/**
100-
* HttpClient对象
99+
* @param client HttpClient对象
100+
* @return 返回当前对象
101101
*/
102102
public HttpConfig client(HttpClient client) {
103103
this.client = client;
104104
return this;
105105
}
106106

107107
/**
108-
* 资源url
108+
* @param url 资源url
109+
* @return 返回当前对象
109110
*/
110111
public HttpConfig url(String url) {
111112
urls.set(url);
112113
return this;
113114
}
114115

115116
/**
116-
* Header头信息
117+
* @param headers Header头信息
118+
* @return 返回当前对象
117119
*/
118120
public HttpConfig headers(Header[] headers) {
119121
this.headers = headers;
@@ -122,6 +124,10 @@ public HttpConfig headers(Header[] headers) {
122124

123125
/**
124126
* Header头信息(是否返回response中的headers)
127+
*
128+
* @param headers Header头信息
129+
* @param isReturnRespHeaders 是否返回response中的headers
130+
* @return 返回当前对象
125131
*/
126132
public HttpConfig headers(Header[] headers, boolean isReturnRespHeaders) {
127133
this.headers = headers;
@@ -130,31 +136,35 @@ public HttpConfig headers(Header[] headers, boolean isReturnRespHeaders) {
130136
}
131137

132138
/**
133-
* 请求方法
139+
* @param method 请求方法
140+
* @return 返回当前对象
134141
*/
135142
public HttpConfig method(HttpMethods method) {
136143
this.method = method;
137144
return this;
138145
}
139146

140147
/**
141-
* 请求方法
148+
* @param methodName 请求方法
149+
* @return 返回当前对象
142150
*/
143151
public HttpConfig methodName(String methodName) {
144152
this.methodName = methodName;
145153
return this;
146154
}
147155

148156
/**
149-
* cookie操作相关
157+
* @param context cookie操作相关
158+
* @return 返回当前对象
150159
*/
151160
public HttpConfig context(HttpContext context) {
152161
this.context = context;
153162
return this;
154163
}
155164

156165
/**
157-
* 传递参数
166+
* @param map 传递参数
167+
* @return 返回当前对象
158168
*/
159169
public HttpConfig map(Map<String, Object> map) {
160170
synchronized (getClass()) {
@@ -168,7 +178,8 @@ public HttpConfig map(Map<String, Object> map) {
168178
}
169179

170180
/**
171-
* 以json格式字符串作为参数
181+
* @param json 以json格式字符串作为参数
182+
* @return 返回当前对象
172183
*/
173184
public HttpConfig json(String json) {
174185
this.json = json;
@@ -178,24 +189,27 @@ public HttpConfig json(String json) {
178189
}
179190

180191
/**
181-
* 上传文件时用到
192+
* @param filePaths 待上传文件所在路径
193+
* @return 返回当前对象
182194
*/
183195
public HttpConfig files(String[] filePaths) {
184196
return files(filePaths, "file");
185197
}
186198
/**
187199
* 上传文件时用到
188-
* @param filePaths 待上传文件所在路径
200+
* @param filePaths 待上传文件所在路径
201+
* @param inputName 即file input 标签的name值,默认为file
202+
* @return 返回当前对象
189203
*/
190204
public HttpConfig files(String[] filePaths, String inputName) {
191205
return files(filePaths, inputName, false);
192206
}
193207
/**
194208
* 上传文件时用到
195-
* @param filePaths 待上传文件所在路径
209+
* @param filePaths 待上传文件所在路径
196210
* @param inputName 即file input 标签的name值,默认为file
197-
* @param forceRemoveContentTypeChraset
198-
* @return
211+
* @param forceRemoveContentTypeChraset 是否强制一处content-type中设置的编码类型
212+
* @return 返回当前对象
199213
*/
200214
public HttpConfig files(String[] filePaths, String inputName, boolean forceRemoveContentTypeChraset) {
201215
synchronized (getClass()) {
@@ -210,7 +224,8 @@ public HttpConfig files(String[] filePaths, String inputName, boolean forceRemov
210224
}
211225

212226
/**
213-
* 输入输出编码
227+
* @param encoding 输入输出编码
228+
* @return 返回当前对象
214229
*/
215230
public HttpConfig encoding(String encoding) {
216231
//设置输入输出
@@ -221,23 +236,26 @@ public HttpConfig encoding(String encoding) {
221236
}
222237

223238
/**
224-
* 输入编码
239+
* @param inenc 输入编码
240+
* @return 返回当前对象
225241
*/
226242
public HttpConfig inenc(String inenc) {
227243
this.inenc = inenc;
228244
return this;
229245
}
230246

231247
/**
232-
* 输出编码
248+
* @param outenc 输出编码
249+
* @return 返回当前对象
233250
*/
234251
public HttpConfig outenc(String outenc) {
235252
this.outenc = outenc;
236253
return this;
237254
}
238255

239256
/**
240-
* 输出流对象
257+
* @param out 输出流对象
258+
* @return 返回当前对象
241259
*/
242260
public HttpConfig out(OutputStream out) {
243261
outs.set(out);

src/main/java/com/arronlong/httpclientutil/common/HttpCookies.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* 封装Cookie
99
*
1010
* @author arron
11-
* @date 2016年1月12日 上午8:42:13
1211
* @version 1.0
1312
*/
1413
public class HttpCookies {

0 commit comments

Comments
 (0)