Browse Source

添加了注释

master
ecoolper 8 years ago
parent
commit
b03cb4b783
6 changed files with 88 additions and 3 deletions
  1. +5
    -0
      weixin-java-common/pom.xml
  2. +21
    -1
      weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/MediaDownloadRequestExecutor.java
  3. +20
    -0
      weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/MediaUploadRequestExecutor.java
  4. +2
    -2
      weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/RequestHttp.java
  5. +20
    -0
      weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/SimpleGetRequestExecutor.java
  6. +20
    -0
      weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/SimplePostRequestExecutor.java

+ 5
- 0
weixin-java-common/pom.xml View File

@@ -39,6 +39,11 @@
<artifactId>jetty-servlet</artifactId> <artifactId>jetty-servlet</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.jodd</groupId>
<artifactId>jodd-http</artifactId>
<version>3.7</version>
</dependency>
</dependencies> </dependencies>


<build> <build>


+ 21
- 1
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/MediaDownloadRequestExecutor.java View File

@@ -85,6 +85,16 @@ public class MediaDownloadRequestExecutor implements RequestExecutor<File, Strin
} }




/**
* apache-http实现方式
* @param httpclient
* @param httpProxy
* @param uri
* @param queryParam
* @return
* @throws WxErrorException
* @throws IOException
*/
private File executeApache(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, IOException { private File executeApache(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, IOException {
if (queryParam != null) { if (queryParam != null) {
if (uri.indexOf('?') == -1) { if (uri.indexOf('?') == -1) {
@@ -127,6 +137,16 @@ public class MediaDownloadRequestExecutor implements RequestExecutor<File, Strin
} }




/**
* jodd-http实现方式
* @param provider
* @param proxyInfo
* @param uri
* @param queryParam
* @return
* @throws WxErrorException
* @throws IOException
*/
private File executeJodd(HttpConnectionProvider provider, ProxyInfo proxyInfo, String uri, String queryParam) throws WxErrorException, IOException { private File executeJodd(HttpConnectionProvider provider, ProxyInfo proxyInfo, String uri, String queryParam) throws WxErrorException, IOException {
if (queryParam != null) { if (queryParam != null) {
if (uri.indexOf('?') == -1) { if (uri.indexOf('?') == -1) {
@@ -135,7 +155,7 @@ public class MediaDownloadRequestExecutor implements RequestExecutor<File, Strin
uri += uri.endsWith("?") ? queryParam : '&' + queryParam; uri += uri.endsWith("?") ? queryParam : '&' + queryParam;
} }


HttpRequest request = HttpRequest.post(uri);
HttpRequest request = HttpRequest.get(uri);
if (proxyInfo != null) { if (proxyInfo != null) {
provider.useProxy(proxyInfo); provider.useProxy(proxyInfo);
} }


+ 20
- 0
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/MediaUploadRequestExecutor.java View File

@@ -47,6 +47,16 @@ public class MediaUploadRequestExecutor implements RequestExecutor<WxMediaUpload


} }


/**
* apache-http实现方式
* @param httpclient
* @param httpProxy
* @param uri
* @param file
* @return
* @throws WxErrorException
* @throws IOException
*/
private WxMediaUploadResult executeApache(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, File file) throws WxErrorException, IOException { private WxMediaUploadResult executeApache(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, File file) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri); HttpPost httpPost = new HttpPost(uri);
if (httpProxy != null) { if (httpProxy != null) {
@@ -75,6 +85,16 @@ public class MediaUploadRequestExecutor implements RequestExecutor<WxMediaUpload
} }




/**
* jodd-http实现方式
* @param provider
* @param proxyInfo
* @param uri
* @param file
* @return
* @throws WxErrorException
* @throws IOException
*/
private WxMediaUploadResult executeJodd(HttpConnectionProvider provider, ProxyInfo proxyInfo, String uri, File file) throws WxErrorException, IOException { private WxMediaUploadResult executeJodd(HttpConnectionProvider provider, ProxyInfo proxyInfo, String uri, File file) throws WxErrorException, IOException {
HttpRequest request = HttpRequest.post(uri); HttpRequest request = HttpRequest.post(uri);
if (proxyInfo != null) { if (proxyInfo != null) {


+ 2
- 2
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/RequestHttp.java View File

@@ -6,13 +6,13 @@ package me.chanjar.weixin.common.util.http;
public interface RequestHttp { public interface RequestHttp {


/** /**
* httpClient
* 返回httpClient
* @return * @return
*/ */
Object getRequestHttpClient(); Object getRequestHttpClient();


/** /**
* httpProxy
* 返回httpProxy
* @return * @return
*/ */
Object getRequestHttpProxy(); Object getRequestHttpProxy();


+ 20
- 0
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/SimpleGetRequestExecutor.java View File

@@ -40,6 +40,16 @@ public class SimpleGetRequestExecutor implements RequestExecutor<String, String>
} }




/**
* apache-http实现方式
* @param httpclient
* @param httpProxy
* @param uri
* @param queryParam
* @return
* @throws WxErrorException
* @throws IOException
*/
private String executeApache(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, IOException { private String executeApache(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String queryParam) throws WxErrorException, IOException {
if (queryParam != null) { if (queryParam != null) {
if (uri.indexOf('?') == -1) { if (uri.indexOf('?') == -1) {
@@ -66,6 +76,16 @@ public class SimpleGetRequestExecutor implements RequestExecutor<String, String>
} }




/**
* jodd-http实现方式
* @param provider
* @param proxyInfo
* @param uri
* @param queryParam
* @return
* @throws WxErrorException
* @throws IOException
*/
private String executeJodd(HttpConnectionProvider provider, ProxyInfo proxyInfo, String uri, String queryParam) throws WxErrorException, IOException { private String executeJodd(HttpConnectionProvider provider, ProxyInfo proxyInfo, String uri, String queryParam) throws WxErrorException, IOException {
if (queryParam != null) { if (queryParam != null) {
if (uri.indexOf('?') == -1) { if (uri.indexOf('?') == -1) {


+ 20
- 0
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/SimplePostRequestExecutor.java View File

@@ -42,6 +42,16 @@ public class SimplePostRequestExecutor implements RequestExecutor<String, String
} }
} }


/**
* apache-http实现方式
* @param httpclient
* @param httpProxy
* @param uri
* @param postEntity
* @return
* @throws WxErrorException
* @throws IOException
*/
private String executeApache(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String postEntity) throws WxErrorException, IOException { private String executeApache(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String postEntity) throws WxErrorException, IOException {
HttpPost httpPost = new HttpPost(uri); HttpPost httpPost = new HttpPost(uri);
if (httpProxy != null) { if (httpProxy != null) {
@@ -78,6 +88,16 @@ public class SimplePostRequestExecutor implements RequestExecutor<String, String
} }




/**
* jodd-http实现方式
* @param provider
* @param proxyInfo
* @param uri
* @param postEntity
* @return
* @throws WxErrorException
* @throws IOException
*/
private String executeJodd(HttpConnectionProvider provider, ProxyInfo proxyInfo, String uri, String postEntity) throws WxErrorException, IOException { private String executeJodd(HttpConnectionProvider provider, ProxyInfo proxyInfo, String uri, String postEntity) throws WxErrorException, IOException {
HttpRequest request = HttpRequest.post(uri); HttpRequest request = HttpRequest.post(uri);
if (proxyInfo != null) { if (proxyInfo != null) {


Loading…
Cancel
Save