资源简介
Tess4j.zip
代码片段和文件信息
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;
import javax.imageio.ImageIO;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.swing.text.html.HTML;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
public class GetCode {
public static void main(String[] args) throws IOException KeyManagementException NoSuchAlgorithmException {
for (int i = 1; i < 2; i++) {
//采用绕过验证的方式处理https请求
SSLContext sslcontext = createIgnoreVerifySSL();
//设置协议http和https对应的处理socket链接工厂的对象
Registry socketFactoryRegistry = RegistryBuilder.create()
.register(“http“ PlainConnectionSocketFactory.INSTANCE)
.register(“https“ new SSLConnectionSocketFactory(sslcontext))
.build();
PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
HttpClients.custom().setConnectionManager(connManager);
//创建自定义的httpclient对象
CloseableHttpClient httpCilent = HttpClients.custom().setConnectionManager(connManager).build();
HttpGet httpGet = new HttpGet(“https://jiaoyi.jjjpjzx.com/validateCode.do“);
HttpResponse response = httpCilent.execute(httpGet);
FileOutputStream out = new FileOutputStream(new File(“aa.png“));
BufferedImage bi = ImageIO.read(response.getEntity().getContent());
ImageIO.write(bi “jpeg“ out);
try {
httpCilent.execute(httpGet);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
httpCilent.close();//释放资源
} catch (IOException e) {
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-08-01 11:32 Tess4j\
文件 6148 2018-08-01 11:23 Tess4j\.DS_Store
目录 0 2018-08-01 11:33 __MACOSX\
目录 0 2018-08-01 11:33 __MACOSX\Tess4j\
文件 120 2018-08-01 11:23 __MACOSX\Tess4j\._.DS_Store
目录 0 2018-08-01 11:32 Tess4j\.idea\
文件 624 2018-07-25 14:46 Tess4j\.idea\compiler.xm
目录 0 2018-07-25 14:45 Tess4j\.idea\inspectionProfiles\
文件 1444 2018-07-25 14:45 Tess4j\.idea\inspectionProfiles\Project_Default.xm
目录 0 2018-07-30 15:08 Tess4j\.idea\libraries\
文件 556 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__ch_qos_logback_logback_classic_1_2_3.xm
文件 535 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__ch_qos_logback_logback_core_1_2_3.xm
文件 595 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__com_github_jai_imageio_jai_imageio_core_1_3_1.xm
文件 474 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__com_lowagie_itext_2_1_7.xm
文件 582 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__commons_beanutils_commons_beanutils_1_9_2.xm
文件 531 2018-07-27 15:46 Tess4j\.idea\libraries\Maven__commons_codec_commons_codec_1_10.xm
文件 604 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__commons_collections_commons_collections_3_2_1.xm
文件 491 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__commons_io_commons_io_2_5.xm
文件 546 2018-07-27 15:46 Tess4j\.idea\libraries\Maven__commons_logging_commons_logging_1_2.xm
文件 443 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__junit_junit_4_12.xm
文件 457 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__log4j_log4j_1_2_17.xm
文件 480 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__net_java_dev_jna_jna_4_1_0.xm
文件 525 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__net_sourceforge_lept4j_lept4j_1_4_0.xm
文件 525 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__net_sourceforge_tess4j_tess4j_3_4_0.xm
文件 565 2018-07-27 15:46 Tess4j\.idea\libraries\Maven__org_apache_httpcomponents_httpclient_4_5_6.xm
文件 558 2018-07-27 15:46 Tess4j\.idea\libraries\Maven__org_apache_httpcomponents_httpcore_4_4_10.xm
文件 602 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__org_apache_xm
文件 488 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__org_ghost4j_ghost4j_1_0_1.xm
文件 520 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__org_hamcrest_hamcrest_core_1_3.xm
文件 543 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__org_jboss_jboss_vfs_3_2_12_Final.xm
文件 575 2018-07-27 16:37 Tess4j\.idea\libraries\Maven__org_jboss_logging_jboss_logging_3_1_4_GA.xm
............此处省略1022个文件信息
- 上一篇:单片机初级教程第三版
- 下一篇:京东商品评论.rar
相关资源
- 京东商品评论.rar
- vg2k105.w2k.tgz
- pdf(7)
- EndNoteX5破解版.zip
- 硬件安全攻防大揭秘.pdf
- pois2.zip
- tor-browser-linux64-7.0.1_en-US.tar.xz
- 旋量代数与李群李代数[戴建生著]20
- b1eab6eefa1f2b8f05b5eb06f3d23219.rar
- vajp38.rar
- 力软敏捷开发框架专业版7.0.zip
- 21个项目玩转深度学习基于TensorFlow的
- 计算机网络.7z
- 新92daikan自动刷课答题v.2.1.zip
- 算法第四版.rar
- MyKTV.rar
- 交互原型axure50套第二版.zip
- 米波现场7.2.5.zip
- xx.tar
- Vue.js实战.pdf
- 威盾IPguard4.23.0707.0内网监控官方.z01
- 力软敏捷企业专业版(V6.1_升级版)
- 嵌入式网络那些事——STM32物联实战
- jdk-8u152-windows-x64.rar
- 新概念模拟电路4-信号处理电路.rar
- 风河Workbench3.0_VxWorks6.6应用程序开发使
- zw_internet_27.zip
- 射频电路设计实战宝典512页145.0M高清
- mathematicaanewkindofscience.pdf
- Vue.js项目实战.pdf
评论
共有 条评论