-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
45 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 25 additions & 23 deletions
48
hk-commons-httpclient/src/main/java/com/hk/commons/http/post/JsonPostHttpExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,45 @@ | ||
package com.hk.commons.http.post; | ||
|
||
import com.hk.commons.util.JsonUtils; | ||
import org.apache.http.Consts; | ||
import org.apache.http.Header; | ||
import org.apache.http.HttpEntity; | ||
import org.apache.http.HttpHeaders; | ||
import org.apache.http.client.ResponseHandler; | ||
import org.apache.http.entity.ContentType; | ||
import org.apache.http.entity.StringEntity; | ||
import org.apache.http.impl.client.CloseableHttpClient; | ||
import org.apache.http.message.BasicHeader; | ||
import org.apache.http.protocol.HTTP; | ||
|
||
import com.hk.commons.util.JsonUtils; | ||
|
||
|
||
/** | ||
* JsonPost请求 | ||
* | ||
* @author kevin | ||
* @date 2017年9月28日上午9:31:24 | ||
*/ | ||
public class JsonPostHttpExecutor extends AbstractPostHttpExecutor<String,Object> { | ||
|
||
public JsonPostHttpExecutor() { | ||
super(BASIC_HANDLER); | ||
} | ||
public JsonPostHttpExecutor(CloseableHttpClient httpClient, ResponseHandler<String> responseHandler) { | ||
super(httpClient, responseHandler); | ||
} | ||
|
||
@Override | ||
public HttpEntity generateEntity(Object params) { | ||
return new StringEntity(JsonUtils.serialize(params), Consts.UTF_8); | ||
} | ||
@Override | ||
protected Header[] generateHeaders() { | ||
return new Header[]{ | ||
new BasicHeader(HTTP.CONTENT_ENCODING, Consts.UTF_8.name()), | ||
new BasicHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()) | ||
public class JsonPostHttpExecutor extends AbstractPostHttpExecutor<String, Object> { | ||
|
||
public JsonPostHttpExecutor() { | ||
super(BASIC_HANDLER); | ||
} | ||
|
||
public JsonPostHttpExecutor(CloseableHttpClient httpClient, ResponseHandler<String> responseHandler) { | ||
super(httpClient, responseHandler); | ||
} | ||
|
||
@Override | ||
public HttpEntity generateEntity(Object params) { | ||
return new StringEntity(JsonUtils.serialize(params), Consts.UTF_8); | ||
} | ||
|
||
@Override | ||
protected Header[] generateHeaders() { | ||
return new Header[]{ | ||
new BasicHeader(HttpHeaders.CONTENT_ENCODING, Consts.UTF_8.name()), | ||
new BasicHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()) | ||
}; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
.../hk/commons/sms/DefaultSmsCodeSender.java → ...m/hk/commons/sms/LoggerSmsCodeSender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters