修复了一个bug
This commit is contained in:
parent
535d078e9d
commit
52bf294516
@ -19,7 +19,7 @@ public abstract class HttpClientFactory {
|
||||
private static volatile HttpClientFactory defaultFactory = newDefaultFactory();
|
||||
|
||||
/**
|
||||
* ApachHttpClient -> SimpleHttpClient(HttpURLConnection)
|
||||
* NettyHttpClient -> ApachHttpClient -> SimpleHttpClient(HttpURLConnection)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ -27,10 +27,10 @@ public abstract class HttpClientFactory {
|
||||
HttpClientFactory f;
|
||||
try {
|
||||
f = new HttpComponent4Factory();
|
||||
} catch (Throwable e1) {
|
||||
} catch (Throwable e2) {
|
||||
try {
|
||||
f = new HttpComponent3Factory();
|
||||
} catch (Throwable e2) {
|
||||
} catch (Throwable e3) {
|
||||
f = new SimpleHttpClientFactory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,6 @@ import org.apache.commons.httpclient.protocol.Protocol;
|
||||
import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.http.AbstractHttpClient;
|
||||
import com.foxinmy.weixin4j.http.HttpClient;
|
||||
import com.foxinmy.weixin4j.http.HttpClientException;
|
||||
import com.foxinmy.weixin4j.http.HttpHeaders;
|
||||
import com.foxinmy.weixin4j.http.HttpMethod;
|
||||
@ -55,7 +54,7 @@ import com.foxinmy.weixin4j.util.StringUtil;
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public class HttpComponent3 extends AbstractHttpClient implements HttpClient {
|
||||
public class HttpComponent3 extends AbstractHttpClient {
|
||||
|
||||
private final org.apache.commons.httpclient.HttpClient httpClient;
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ import com.foxinmy.weixin4j.model.Consts;
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public class HttpComponent4_1 extends HttpComponent4 implements HttpClient {
|
||||
public class HttpComponent4_1 extends HttpComponent4 {
|
||||
|
||||
private final org.apache.http.client.HttpClient httpClient;
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@ import org.apache.http.conn.ssl.X509HostnameVerifier;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
|
||||
import com.foxinmy.weixin4j.http.HttpClient;
|
||||
import com.foxinmy.weixin4j.http.HttpClientException;
|
||||
import com.foxinmy.weixin4j.http.HttpParams;
|
||||
import com.foxinmy.weixin4j.http.HttpRequest;
|
||||
@ -28,7 +27,7 @@ import com.foxinmy.weixin4j.http.HttpResponse;
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public class HttpComponent4_2 extends HttpComponent4 implements HttpClient {
|
||||
public class HttpComponent4_2 extends HttpComponent4 {
|
||||
|
||||
private CloseableHttpClient httpClient;
|
||||
|
||||
|
||||
@ -586,8 +586,12 @@ public class MediaApi extends MpApi {
|
||||
MediaRecord mediaRecord = null;
|
||||
for (;;) {
|
||||
mediaRecord = listMaterialMedia(mediaType, pageable);
|
||||
if (mediaRecord.getItems() == null
|
||||
|| !mediaRecord.getItems().isEmpty()) {
|
||||
break;
|
||||
}
|
||||
mediaList.addAll(mediaRecord.getItems());
|
||||
if (pageable.getOffset() >= mediaRecord.getTotalCount()) {
|
||||
if (!mediaRecord.getPagedata().hasNext()) {
|
||||
break;
|
||||
}
|
||||
pageable = pageable.next();
|
||||
|
||||
@ -471,8 +471,12 @@ public class MediaApi extends QyApi {
|
||||
MediaRecord mediaRecord = null;
|
||||
for (;;) {
|
||||
mediaRecord = listMaterialMedia(agentid, mediaType, pageable);
|
||||
if (mediaRecord.getItems() == null
|
||||
|| !mediaRecord.getItems().isEmpty()) {
|
||||
break;
|
||||
}
|
||||
mediaList.addAll(mediaRecord.getItems());
|
||||
if (pageable.getOffset() >= mediaRecord.getTotalCount()) {
|
||||
if (!mediaRecord.getPagedata().hasNext()) {
|
||||
break;
|
||||
}
|
||||
pageable = pageable.next();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user