- 浏览: 4864297 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (743)
- JAVA (44)
- JAVA 乔乐共享 (145)
- js (132)
- database (26)
- jQuery (46)
- velocity (16)
- Ubuntu (14)
- Grails (2)
- Groovy (6)
- xml (2)
- Spring (11)
- mysql (24)
- sqlserver (6)
- oracle (9)
- cmd (8)
- CSS (17)
- Linux (2)
- sqlite (4)
- php (11)
- json (2)
- laravel (2)
- html (3)
- 闲聊 (3)
- git (13)
- nodejs (25)
- angularjs (17)
- npm (8)
- bootstrap (4)
- mongodb (5)
- React (32)
- Crack (7)
- b (0)
- ES6 (2)
- webpack (3)
- Babel (1)
- Koa (1)
最新评论
-
taoshengyijiuzt:
感谢大佬!!!
JetBrains最新激活服务器(长期更新ing) -
masuweng:
激活码可以用
JetBrains最新激活服务器(长期更新ing) -
dusdong:
都失效了
JetBrains最新激活服务器(长期更新ing) -
追风筝的孩纸Zz:
dddddddddddddddd
js获取网页屏幕可见区域高度 -
自己811005:
88350bcf69dcfbda7f8a76a589d9054 ...
Js设置前端允许跨域请求后端API:Access-Control-Allow-Credentials
package com.proxy.util; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.http.Header; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.params.CoreConnectionPNames; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.anxin.common.util.SSLUtil; /** * HTTP工具类. * * @author David.Huang */ public class HttpUtil { private static Logger log = LoggerFactory.getLogger(HttpUtil.class); /** 默认编码方式 -UTF8 */ private static final String DEFAULT_ENCODE = "utf-8"; // 信任所有站点 static { SSLUtil.trustAllHostnames(); SSLUtil.trustAllHttpsCertificates(); } /** * 构造方法 */ public HttpUtil() { // empty constructor for some tools that need an instance object of the // class } /** * GET请求, 结果以字符串形式返回. * * @param url * 请求地址 * @return 内容字符串 */ public static String getUrlAsString(String url) throws Exception { return getUrlAsString(url, null, DEFAULT_ENCODE); } /** * GET请求, 结果以字符串形式返回. * * @param url * 请求地址 * @param params * 请求参数 * @return 内容字符串 */ public static String getUrlAsString(String url, Map<String, String> params) throws Exception { return getUrlAsString(url, params, DEFAULT_ENCODE); } /** * GET请求, 结果以字符串形式返回. * * @param url * 请求地址 * @param params * 请求参数 * @param encode * 编码方式 * @return 内容字符串 */ public static String getUrlAsString(String url, Map<String, String> params, String encode) throws Exception { // 开始时间 long t1 = System.currentTimeMillis(); // 获得HttpGet对象 HttpGet httpGet = getHttpGet(url, params, encode); // 调试信息 log.debug("url:" + url); log.debug("params:" + params.toString()); log.debug("encode:" + encode); // 发送请求 String result = executeHttpRequest(httpGet, null); // 结束时间 long t2 = System.currentTimeMillis(); // 调试信息 log.debug("result:" + result); log.debug("consume time:" + ((t2 - t1))); // 返回结果 return result; } /** * POST请求, 结果以字符串形式返回. * * @param url * 请求地址 * @return 内容字符串 */ public static String postUrlAsString(String url) throws Exception { return postUrlAsString(url, null, null, null); } /** * POST请求, 结果以字符串形式返回. * * @param url * 请求地址 * @param params * 请求参数 * @return 内容字符串 */ public static String postUrlAsString(String url, Map<String, String> params) throws Exception { return postUrlAsString(url, params, null, null); } /** * POST请求, 结果以字符串形式返回. * * @param url * 请求地址 * @param params * 请求参数 * @param reqHeader * 请求头内容 * @return 内容字符串 * @throws Exception */ public static String postUrlAsString(String url, Map<String, String> params, Map<String, String> reqHeader) throws Exception { return postUrlAsString(url, params, reqHeader, null); } /** * POST请求, 结果以字符串形式返回. * * @param url * 请求地址 * @param params * 请求参数 * @param reqHeader * 请求头内容 * @param encode * 编码方式 * @return 内容字符串 * @throws Exception */ public static String postUrlAsString(String url, Map<String, String> params, Map<String, String> reqHeader, String encode) throws Exception { // 开始时间 long t1 = System.currentTimeMillis(); // 获得HttpPost对象 HttpPost httpPost = getHttpPost(url, params, encode); // 发送请求 String result = executeHttpRequest(httpPost, reqHeader); // 结束时间 long t2 = System.currentTimeMillis(); // 调试信息 log.debug("url:" + url); log.debug("params:" + params.toString()); log.debug("reqHeader:" + reqHeader); log.debug("encode:" + encode); log.debug("result:" + result); log.debug("consume time:" + ((t2 - t1))); // 返回结果 return result; } /** * 获得HttpGet对象 * * @param url * 请求地址 * @param params * 请求参数 * @param encode * 编码方式 * @return HttpGet对象 */ private static HttpGet getHttpGet(String url, Map<String, String> params, String encode) { StringBuffer buf = new StringBuffer(url); if (params != null) { // 地址增加?或者& String flag = (url.indexOf('?') == -1) ? "?" : "&"; // 添加参数 for (String name : params.keySet()) { buf.append(flag); buf.append(name); buf.append("="); try { String param = params.get(name); if (param == null) { param = ""; } buf.append(URLEncoder.encode(param, encode)); } catch (UnsupportedEncodingException e) { log.error("URLEncoder Error,encode=" + encode + ",param=" + params.get(name), e); } flag = "&"; } } HttpGet httpGet = new HttpGet(buf.toString()); return httpGet; } /** * 获得HttpPost对象 * * @param url * 请求地址 * @param params * 请求参数 * @param encode * 编码方式 * @return HttpPost对象 */ private static HttpPost getHttpPost(String url, Map<String, String> params, String encode) { HttpPost httpPost = new HttpPost(url); if (params != null) { List<NameValuePair> form = new ArrayList<NameValuePair>(); for (String name : params.keySet()) { form.add(new BasicNameValuePair(name, params.get(name))); } try { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, encode); httpPost.setEntity(entity); } catch (UnsupportedEncodingException e) { log.error("UrlEncodedFormEntity Error,encode=" + encode + ",form=" + form, e); } } return httpPost; } /** * 执行HTTP请求 * * @param request * 请求对象 * @param reqHeader * 请求头信息 * @return 内容字符串 */ private static String executeHttpRequest(HttpUriRequest request, Map<String, String> reqHeader) throws Exception { HttpClient client = null; String result = null; try { // 创建HttpClient对象 client = new DefaultHttpClient(); // 设置连接超时时间 client.getParams().setParameter( CoreConnectionPNames.CONNECTION_TIMEOUT, 60); // 设置Socket超时时间 client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 36600); // 设置请求头信息 if (reqHeader != null) { for (String name : reqHeader.keySet()) { request.addHeader(name, reqHeader.get(name)); } } // 获得返回结果 HttpResponse response = client.execute(request); // 如果成功 if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { result = EntityUtils.toString(response.getEntity()); } // 如果失败 else { StringBuffer errorMsg = new StringBuffer(); errorMsg.append("httpStatus:"); errorMsg.append(response.getStatusLine().getStatusCode()); errorMsg.append(response.getStatusLine().getReasonPhrase()); errorMsg.append(", Header: "); Header[] headers = response.getAllHeaders(); for (Header header : headers) { errorMsg.append(header.getName()); errorMsg.append(":"); errorMsg.append(header.getValue()); } log.error("HttpResonse Error:" + errorMsg); } } catch (Exception e) { log.error("http连接异常", e); throw new Exception("http连接异常"); } finally { try { client.getConnectionManager().shutdown(); } catch (Exception e) { log.error("finally HttpClient shutdown error", e); } } return result; } /** * 下载文件保存到本地 * * @param path * 文件保存位置 * @param url * 文件地址 * @throws IOException */ public static void downloadFile(String path, String url) throws IOException { log.debug("path:" + path); log.debug("url:" + url); HttpClient client = null; try { // 创建HttpClient对象 client = new DefaultHttpClient(); // 获得HttpGet对象 HttpGet httpGet = getHttpGet(url, null, null); // 发送请求获得返回结果 HttpResponse response = client.execute(httpGet); // 如果成功 if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { byte[] result = EntityUtils.toByteArray(response.getEntity()); BufferedOutputStream bw = null; try { // 创建文件对象 File f = new File(path); // 创建文件路径 if (!f.getParentFile().exists()) f.getParentFile().mkdirs(); // 写入文件 bw = new BufferedOutputStream(new FileOutputStream(path)); bw.write(result); } catch (Exception e) { log.error("保存文件错误,path=" + path + ",url=" + url, e); } finally { try { if (bw != null) bw.close(); } catch (Exception e) { log.error( "finally BufferedOutputStream shutdown close", e); } } } // 如果失败 else { StringBuffer errorMsg = new StringBuffer(); errorMsg.append("httpStatus:"); errorMsg.append(response.getStatusLine().getStatusCode()); errorMsg.append(response.getStatusLine().getReasonPhrase()); errorMsg.append(", Header: "); Header[] headers = response.getAllHeaders(); for (Header header : headers) { errorMsg.append(header.getName()); errorMsg.append(":"); errorMsg.append(header.getValue()); } log.error("HttpResonse Error:" + errorMsg); } } catch (ClientProtocolException e) { log.error("下载文件保存到本地,http连接异常,path=" + path + ",url=" + url, e); throw e; } catch (IOException e) { log.error("下载文件保存到本地,文件操作异常,path=" + path + ",url=" + url, e); throw e; } finally { try { client.getConnectionManager().shutdown(); } catch (Exception e) { log.error("finally HttpClient shutdown error", e); } } } public static void main(String[] args) throws IOException { // String result = getUrlAsString("http://www.gewara.com/"); // System.out.println(result); downloadFile("F:/logo3w.png", "http://www.google.com.hk/images/srpr/logo3w.png"); } }
评论
5 楼
yizhichao116
2016-09-01
byte[] result = EntityUtils.toByteArray(response.getEntity());
这边这样处理不太好吧,如果文件过大的时候。。。
这边这样处理不太好吧,如果文件过大的时候。。。
4 楼
ljlowkey
2015-07-17
大文件下载貌似很慢,求解
3 楼
zt307484565
2014-12-28
赞!好用。
2 楼
qiaolevip
2014-03-24
wangjieisjason1985 写道
你好,可否将你的代码共享全一些;wangjieisjason@163.com
import com.anxin.common.util.SSLUtil;
import com.anxin.common.util.SSLUtil;
package com.anxin.ssk.util; import java.security.GeneralSecurityException; import java.security.SecureRandom; import java.security.cert.X509Certificate; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; /** * This class provide various static methods that relax X509 certificate and hostname verification while using the SSL * over the HTTP protocol. * * @author Francis Labrie */ @SuppressWarnings("restriction") public final class SSLUtil { /** * Hostname verifier for the Sun's deprecated API. * * @deprecated see {@link #_hostnameVerifier}. */ private static com.sun.net.ssl.HostnameVerifier __hostnameVerifier; /** * Thrust managers for the Sun's deprecated API. * * @deprecated see {@link #_trustManagers}. */ private static com.sun.net.ssl.TrustManager[] __trustManagers; /** * Hostname verifier. */ private static HostnameVerifier _hostnameVerifier; /** * Thrust managers. */ private static TrustManager[] _trustManagers; /** * Set the default Hostname Verifier to an instance of a fake class that trust all hostnames. This method uses the * old deprecated API from the com.sun.ssl package. * * @deprecated see {@link #_trustAllHostnames()}. */ private static void __trustAllHostnames() { // Create a trust manager that does not validate certificate chains if (__hostnameVerifier == null) { __hostnameVerifier = new _FakeHostnameVerifier(); } // if // Install the all-trusting host name verifier com.sun.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(__hostnameVerifier); } // __trustAllHttpsCertificates /** * Set the default X509 Trust Manager to an instance of a fake class that trust all certificates, even the * self-signed ones. This method uses the old deprecated API from the com.sun.ssl package. * * @deprecated see {@link #_trustAllHttpsCertificates()}. */ private static void __trustAllHttpsCertificates() { com.sun.net.ssl.SSLContext context; // Create a trust manager that does not validate certificate chains if (__trustManagers == null) { __trustManagers = new com.sun.net.ssl.TrustManager[] { new _FakeX509TrustManager() }; } // if // Install the all-trusting trust manager try { context = com.sun.net.ssl.SSLContext.getInstance("SSL"); context.init(null, __trustManagers, new SecureRandom()); } catch (GeneralSecurityException gse) { throw new IllegalStateException(gse.getMessage()); } // catch com.sun.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory()); } // __trustAllHttpsCertificates /** * Return true if the protocol handler property java. protocol.handler.pkgs is set to the Sun's com.sun.net.ssl. * internal.www.protocol deprecated one, false otherwise. * * @return true if the protocol handler property is set to the Sun's deprecated one, false otherwise. */ private static boolean isDeprecatedSSLProtocol() { return ("com.sun.net.ssl.internal.www.protocol".equals(System.getProperty("java.protocol.handler.pkgs"))); } // isDeprecatedSSLProtocol /** * Set the default Hostname Verifier to an instance of a fake class that trust all hostnames. */ private static void _trustAllHostnames() { // Create a trust manager that does not validate certificate chains if (_hostnameVerifier == null) { _hostnameVerifier = new FakeHostnameVerifier(); } // if // Install the all-trusting host name verifier: HttpsURLConnection.setDefaultHostnameVerifier(_hostnameVerifier); } // _trustAllHttpsCertificates /** * Set the default X509 Trust Manager to an instance of a fake class that trust all certificates, even the * self-signed ones. */ private static void _trustAllHttpsCertificates() { SSLContext context; // Create a trust manager that does not validate certificate chains if (_trustManagers == null) { _trustManagers = new TrustManager[] { new FakeX509TrustManager() }; } // if // Install the all-trusting trust manager: try { context = SSLContext.getInstance("SSL"); context.init(null, _trustManagers, new SecureRandom()); } catch (GeneralSecurityException gse) { throw new IllegalStateException(gse.getMessage()); } // catch HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory()); } // _trustAllHttpsCertificates /** * Set the default Hostname Verifier to an instance of a fake class that trust all hostnames. */ public static void trustAllHostnames() { // Is the deprecated protocol setted? if (isDeprecatedSSLProtocol()) { __trustAllHostnames(); } else { _trustAllHostnames(); } // else } // trustAllHostnames /** * Set the default X509 Trust Manager to an instance of a fake class that trust all certificates, even the * self-signed ones. */ public static void trustAllHttpsCertificates() { // Is the deprecated protocol setted? if (isDeprecatedSSLProtocol()) { __trustAllHttpsCertificates(); } else { _trustAllHttpsCertificates(); } // else } // trustAllHttpsCertificates /** * This class implements a fake hostname verificator, trusting any host name. This class uses the old deprecated API * from the com.sun. ssl package. * * @author Francis Labrie * * @deprecated see {@link SSLUtil.FakeHostnameVerifier}. */ public static class _FakeHostnameVerifier implements com.sun.net.ssl.HostnameVerifier { /** * Always return true, indicating that the host name is an acceptable match with the server's authentication * scheme. * * @param hostname the host name. * @param session the SSL session used on the connection to host. * @return the true boolean value indicating the host name is trusted. */ public boolean verify(String hostname, String session) { return (true); } // verify } // _FakeHostnameVerifier /** * This class allow any X509 certificates to be used to authenticate the remote side of a secure socket, including * self-signed certificates. This class uses the old deprecated API from the com.sun.ssl package. * * @author Francis Labrie * * @deprecated see {@link SSLUtil.FakeX509TrustManager}. */ public static class _FakeX509TrustManager implements com.sun.net.ssl.X509TrustManager { /** * Empty array of certificate authority certificates. */ private static final X509Certificate[] _AcceptedIssuers = new X509Certificate[] {}; /** * Always return true, trusting for client SSL chain peer certificate chain. * * @param chain the peer certificate chain. * @return the true boolean value indicating the chain is trusted. */ public boolean isClientTrusted(X509Certificate[] chain) { return (true); } // checkClientTrusted /** * Always return true, trusting for server SSL chain peer certificate chain. * * @param chain the peer certificate chain. * @return the true boolean value indicating the chain is trusted. */ public boolean isServerTrusted(X509Certificate[] chain) { return (true); } // checkServerTrusted /** * Return an empty array of certificate authority certificates which are trusted for authenticating peers. * * @return a empty array of issuer certificates. */ public X509Certificate[] getAcceptedIssuers() { return (_AcceptedIssuers); } // getAcceptedIssuers } // _FakeX509TrustManager /** * This class implements a fake hostname verificator, trusting any host name. * * @author Francis Labrie */ public static class FakeHostnameVerifier implements HostnameVerifier { /** * Always return true, indicating that the host name is an acceptable match with the server's authentication * scheme. * * @param hostname the host name. * @param session the SSL session used on the connection to host. * @return the true boolean value indicating the host name is trusted. */ public boolean verify(String hostname, javax.net.ssl.SSLSession session) { return (true); } // verify } // FakeHostnameVerifier /** * This class allow any X509 certificates to be used to authenticate the remote side of a secure socket, including * self-signed certificates. * * @author Francis Labrie */ public static class FakeX509TrustManager implements X509TrustManager { /** * Empty array of certificate authority certificates. */ private static final X509Certificate[] _AcceptedIssuers = new X509Certificate[] {}; /** * Always trust for client SSL chain peer certificate chain with any authType authentication types. * * @param chain the peer certificate chain. * @param authType the authentication type based on the client certificate. */ public void checkClientTrusted(X509Certificate[] chain, String authType) { } // checkClientTrusted /** * Always trust for server SSL chain peer certificate chain with any authType exchange algorithm types. * * @param chain the peer certificate chain. * @param authType the key exchange algorithm used. */ public void checkServerTrusted(X509Certificate[] chain, String authType) { } // checkServerTrusted /** * Return an empty array of certificate authority certificates which are trusted for authenticating peers. * * @return a empty array of issuer certificates. */ public X509Certificate[] getAcceptedIssuers() { return (_AcceptedIssuers); } // getAcceptedIssuers } // FakeX509TrustManager } // SSLUtilities
1 楼
wangjieisjason1985
2014-03-21
你好,可否将你的代码共享全一些;wangjieisjason@163.com
import com.anxin.common.util.SSLUtil;
import com.anxin.common.util.SSLUtil;
发表评论
-
JAX-WS获取天气预报wsdl
2014-08-01 12:14 1498天气预报地址:http://www.webxml.com.c ... -
巴西世界杯期间,32支强队对战情况一览表
2014-07-07 15:53 775积分 A 巴西 7 墨西哥 ... -
Hp(中国上海)第一次电话面试
2014-07-07 13:45 1483时间:发简历的第二天 方式:电话面试 时长:25m 内 ... -
Java判断当前时间是否在两个时间段内
2014-04-11 18:59 24807// 播放时间段格式:0000-2359 String ... -
Java启动本机应用程序EXE的三种方式
2014-04-03 10:06 11366// 第一种方式:利用cmd方式 /** * ... -
ProcessBuilder实例启动一个新的应用程序
2014-04-03 10:01 1526/** * 启动应用程序 * * @pa ... -
Java判断应用程序启动状态并打开或关闭应用程序
2014-04-02 15:43 2001package com.anxin.ssk.util; ... -
Java cmd判断本地网络状态及强度
2014-04-02 14:06 1558package com.anxin.ssk.util; ... -
Java获取Set中第一个值
2014-03-18 16:21 23864Map<String, List<Cinema ... -
java取汉字拼音首字母含多音字及不常见的字
2014-03-13 11:25 10520package com.anxin.ssk.common; ... -
Java汉字区位码计算机对照表
2014-03-06 11:47 19175package com.anxin.ssk.common; ... -
java汉字转拼音或首字母,手写版非pinyin4j,可排除例外
2014-03-06 11:16 2133package com.anxin.ssk.common; ... -
JAVA调用spring注入class
2014-01-21 15:55 3816<?xml version="1.0&quo ... -
java.util.ConcurrentModificationException 原因及解决方案
2013-12-19 20:17 221312:13:30,822 [ERROR] 优惠券缓存 初始化 ... -
创建多人机票订单数据结构
2013-12-05 00:03 1704public AirplaneCreateOrderResu ... -
java断点续传原理总结
2013-10-18 13:36 1620断点续传总结 断点续传的原理: 断点续传的原理很简单,就 ... -
妙用分隔符分割循环数据
2013-08-14 10:08 1336public static void main(Strin ... -
spring还可以这样配置list对象
2013-05-24 16:12 2507// 配置内容 <entry key="s ... -
List<String>转换String[]或String
2013-05-10 15:52 1177List<String> strlist = ... -
Spring MVC 三种参数注入
2013-04-16 22:43 29051)参数注入第一种方法 <!-- xml服务 - ...
相关推荐
JAVA下载远程文件到本地的最精简代码,就一行代码,不信自己看,而且是官方提供,绝对适合你,一个远程URL,一个本地路径,文件就在你的电脑上了
Eclipse下完整的java程序,包含HttpClient的全部jar包。通过java类文件,实现通过链接将文件下载本地
java下载网络图片到本地保存,还有一个配置文件,用来配置url和保存地址。
实现Linux与windows文件互传,用HTML实现网页版上传文件下载的界面,目前配置是Linux服务器,本地运行需要切换配置
使用java将百度的首页或其他网上资源页面文件,mp3,音乐下载到本地桌面或任何路径
JAVA代码,通过文件名及文件的路径(全路径)实现本地文件的下载。
JAVA打开本地文件,测试了HTML文件和txt文件
主要介绍了通过JavaScript下载文件到本地的方法(单文件),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
java上传本地文件到oss指定目录,包含具体怎么使用,只需要改变一下配置文件就可以使用,如有疑问联系我QQ1058070168
java文件下载的几种方式
java生成excel并下载到本地(可选择保存路径),文件通过流的形式响应客户端浏览器下载到本地。
根据参数accessKey,secretKey,regionName,bucketName等参数,对阿里云、腾讯云、京东云、华为云上的文件存储对象的下载
下载服务器文件到本地,并删除已下载的服务器文件
能够在指定时间间隔就实现一次同步操作,可以把ftp目录下指定的文件夹中的所有文件复制到本地指定目录,还能判断是否已经复制过,如果复制过就不再复制
JAVA读取远程网页文件并保存本地 从远程URL地址获取网页文件下载到本地 这个方法可以生成静态HTML文件使用!
java操作本地文件 实现本地文件的增,删,改,查,重命名
通过java程序来删除本地文件
用java语言编写的ftp小工具,可以按指定时间监控ftp服务器,把服务器指定目录内新产生的文件或者文件夹下载到本地指定文件夹,下载后删除数据。 也可以监控本地文件夹,把文件夹内新产生的文件或者文件夹整体上传到...
java读取本地.db文件简单方法,sqlite数据库类型文件获取数据
本篇文章主要介绍了Java+mysql本地图片上传数据库及下载示例,具有一定的参加价值,有兴趣的可以了解一下。