代码
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyHttpClientUtils {
private static Logger logger = LoggerFactory.getLogger(MyHttpClientUtils.class);
private static final int HTTPCLIENT_TIMEOUT = 5000;
public static Tuple2<Boolean,String> getPageByUrl(String pageUrl, String encode) throws UnsupportedEncodingException{
logger.info("pageurl=" + pageUrl);
String body = null;
RequestConfig req