| @@ -17,6 +17,8 @@ import org.apache.http.client.methods.CloseableHttpResponse; | |||||
| import org.apache.http.client.methods.HttpPost; | import org.apache.http.client.methods.HttpPost; | ||||
| import org.apache.http.entity.StringEntity; | import org.apache.http.entity.StringEntity; | ||||
| import org.apache.http.impl.client.CloseableHttpClient; | import org.apache.http.impl.client.CloseableHttpClient; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.util.regex.Matcher; | import java.util.regex.Matcher; | ||||
| @@ -29,6 +31,7 @@ import java.util.regex.Pattern; | |||||
| * @date 2017/5/4 | * @date 2017/5/4 | ||||
| */ | */ | ||||
| public class TtWebPostRequestExecutor implements RequestExecutor<String, String> { | public class TtWebPostRequestExecutor implements RequestExecutor<String, String> { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| protected RequestHttp<CloseableHttpClient, HttpHost> requestHttp; | protected RequestHttp<CloseableHttpClient, HttpHost> requestHttp; | ||||
| public TtWebPostRequestExecutor(RequestHttp requestHttp) { | public TtWebPostRequestExecutor(RequestHttp requestHttp) { | ||||
| @@ -43,7 +46,8 @@ public class TtWebPostRequestExecutor implements RequestExecutor<String, String> | |||||
| @Override | @Override | ||||
| public String execute(String uri, String postEntity, WxType wxType) throws WxErrorException, IOException { | public String execute(String uri, String postEntity, WxType wxType) throws WxErrorException, IOException { | ||||
| logger.info("uri{}"+uri); | |||||
| logger.info("request{}"+postEntity); | |||||
| String access_token = handleUrl(uri); | String access_token = handleUrl(uri); | ||||
| if(StringUtils.isBlank(access_token)){ | if(StringUtils.isBlank(access_token)){ | ||||
| WxError wxError = WxError.fromJson("{\n" + | WxError wxError = WxError.fromJson("{\n" + | ||||
| @@ -70,6 +74,7 @@ public class TtWebPostRequestExecutor implements RequestExecutor<String, String> | |||||
| try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpPost)) { | try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpPost)) { | ||||
| String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); | String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); | ||||
| logger.info("response{}"+responseContent); | |||||
| if (responseContent.isEmpty()) { | if (responseContent.isEmpty()) { | ||||
| throw new WxErrorException(WxError.builder().errorCode(9999).errorMsg("无响应内容").build()); | throw new WxErrorException(WxError.builder().errorCode(9999).errorMsg("无响应内容").build()); | ||||
| } | } | ||||