• 大小: 7.05MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-23
  • 语言: 其他
  • 标签: 四级联动  

资源简介

省市区镇四级联动附代码和数据库

资源截图

代码片段和文件信息

package com.httptest;

import java.io.UnsupportedEncodingException;  
import java.util.ArrayList;  
import java.util.Date;
import java.util.HashMap;
import java.util.List;  
import java.util.Map;  
  

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.apache.commons.codec.binary.StringUtils;
import org.apache.http.HttpEntity;  
import org.apache.http.NameValuePair;  
import org.apache.http.client.config.RequestConfig;  
import org.apache.http.client.entity.UrlEncodedFormEntity;  
import org.apache.http.client.methods.CloseableHttpResponse;  
import org.apache.http.client.methods.HttpGet;  
import org.apache.http.client.methods.HttpPost;  
import org.apache.http.entity.StringEntity;  
import org.apache.http.impl.client.CloseableHttpClient;  
import org.apache.http.impl.client.HttpClients;  
import org.apache.http.impl.client.LaxRedirectStrategy;  
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;  
import org.apache.http.message.BasicNameValuePair;  
import org.apache.http.util.EntityUtils;  

import com.sun.corba.se.impl.orbutil.closure.Future;
  
/**
 *   
 * @author mobo
 *
 */
public class CopyOfTest2 {  
  
private static final CloseableHttpClient httpClient;
public static final String CHARSET_GBK = “GBK“;
public static final String CHARSET_UTF8 = “UTF-8“;
// 将最大连接数增加到
public static final int MAX_TOTAL = 600;
// 将每个路由基础的连接增加到
public static final int MAX_ROUTE_TOTAL = 300;
public static final int REQUEST_TIMEOUT = 5 * 1000;
public static final int REQUEST_SOCKET_TIME = 5 * 1000;  
      
      
    /*static { 
        //设置连接超时 的时间 
        RequestConfig config = RequestConfig.custom().setConnectTimeout(60000) 
                .setSocketTimeout(15000).build(); 
         
        httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config) 
                .build(); 
    }*/  
      
static {
// 设置连接超时 的时间

PoolingHttpClientConnectionManager httpClientConnectionManager = new PoolingHttpClientConnectionManager();
httpClientConnectionManager.setMaxTotal(MAX_TOTAL);
httpClientConnectionManager.setDefaultMaxPerRoute(MAX_ROUTE_TOTAL);

RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(REQUEST_TIMEOUT)
.setSocketTimeout(REQUEST_SOCKET_TIME).build();
// 设置重定向策略
LaxRedirectStrategy redirectStrategy = new LaxRedirectStrategy();

httpClient = HttpClients.custom()
.setConnectionManager(httpClientConnectionManager)
.setDefaultRequestConfig(requestConfig)
.setRedirectStrategy(redirectStrategy).build();
}
/**
 * 发起get请求
 * @param url 请求链接
 * @param params 请求参数
 * @return HttpResEntity
 */
    public static HttpResEntity doGet(String url Mapject> params) {  
HttpResEntity entity = new HttpResEntity();
if (null == url || ““.equa

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件     4192788  2014-04-15 10:24  test.sql
     目录           0  2016-06-29 15:57  Test1\
     文件        2521  2016-06-29 14:54  Test1\.classpath
     文件        1038  2016-06-23 16:44  Test1\.project
     目录           0  2016-06-29 15:57  Test1\.settings\
     文件         503  2016-06-23 16:44  Test1\.settings\.jsdtscope
     文件         101  2016-06-29 12:40  Test1\.settings\org.eclipse.core.resources.prefs
     文件          52  2016-06-29 12:03  Test1\.settings\org.eclipse.core.runtime.prefs
     文件         364  2016-06-23 16:44  Test1\.settings\org.eclipse.jdt.core.prefs
     文件         467  2016-06-23 16:44  Test1\.settings\org.eclipse.wst.common.component
     文件         345  2016-06-23 16:44  Test1\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2016-06-23 16:44  Test1\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2016-06-23 16:44  Test1\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2016-06-29 15:57  Test1\build\
     目录           0  2016-06-29 15:57  Test1\build\classes\
     目录           0  2016-06-29 15:57  Test1\build\classes\com\
     目录           0  2016-06-29 15:57  Test1\build\classes\com\httptest\
     文件        7799  2016-06-29 14:54  Test1\build\classes\com\httptest\CopyOfTest2.class
     文件        2769  2016-06-29 14:54  Test1\build\classes\com\httptest\CustomerHttpClient.class
     文件        1397  2016-06-29 14:54  Test1\build\classes\com\httptest\HttpResEntity.class
     文件        8116  2016-06-29 14:54  Test1\build\classes\com\httptest\Test2.class
     目录           0  2016-06-29 15:57  Test1\build\classes\com\wbnf\
     目录           0  2016-06-29 15:57  Test1\build\classes\com\wbnf\action\
     文件        2008  2016-06-29 14:54  Test1\build\classes\com\wbnf\action\AreaServlet.class
     文件        2226  2016-06-29 15:09  Test1\build\classes\com\wbnf\action\CityServlet.class
     目录           0  2016-06-29 15:57  Test1\build\classes\com\wbnf\dao\
     文件        2612  2016-06-29 14:54  Test1\build\classes\com\wbnf\dao\AreaDao.class
     目录           0  2016-06-29 15:57  Test1\build\classes\com\wbnf\model\
     文件        1918  2016-06-29 14:54  Test1\build\classes\com\wbnf\model\YbArea.class
     目录           0  2016-06-29 15:57  Test1\build\classes\com\wbnf\tools\
     文件        1234  2016-06-29 14:54  Test1\build\classes\com\wbnf\tools\JDBCTools.class
............此处省略63个文件信息

评论

共有 条评论