火车票订购系统[url] http://www.12306.cn/mormhweb/kyfw/[/url]
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
/**
* @author zhengyisheng E-mail:zhengyisheng@corp.netease.com
* @version CreateTime��2012-1-16 ����09:47:25
* @see Class Description
*/
public class TestTicket {
public static void main(String[] args) throws Exception {
try{
TrustManager easyTrustManager = new X509TrustManager() {
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws java.security.cert.CertificateException {
}
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws java.security.cert.CertificateException {
//To change body of implemented methods use File | Settings | File Templates.
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[0]; //To change body of implemented methods use File | Settings | File Templates.
}
};
SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[]{easyTrustManager}, null);
SSLSocketFactory sf = new SSLSocketFactory(sslcontext);
Scheme sch = new Scheme("https", sf, 443);
HttpClient httpclient = new DefaultHttpClient();
httpclient.getConnectionManager().getSchemeRegistry().register(sch);
HttpPost httpPost = null;
httpPost = new HttpPost("https://dynamic.12306.cn/otsweb/loginAction.do?method=init");
HttpResponse response = httpclient.execute(httpPost);
InputStream is = response.getEntity().getContent();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = "";
while ((line = br.readLine()) != null) {
System.out.println(line);
}
}catch(Exception e){
e.printStackTrace();
}
}
}
分享到:
相关推荐
struts2一个action处理多个请求
方式一:Action本身作为Model对象,通过属性注入(Setter)方法讲参数数据封装到Action中 具体为:在Action中,提供和参数名相同的几个属性,并为其提供set方法,那么,该参数会被自动封装 到该几个属性中. ...
<td valign="top"><form id="form1" name="form1" method="post" action="loginaction.do"> <td colspan="2"><div align="center"> </div></td> </tr><tr> <td colspan="2"><div align="center"> ...
资源中示例了一个struts2的配置文件中配置的action的result结果为另外一个action的配置,该跳转的过程中是带所有参赛调整的,在另外一个action中可以接受到当前action的所有参数,此配置文件是我日常开发中的经验...
该项目实现简单的ajax异步请求action,接收json数据并显示到页面
该长途汽车订票系统采用ssh(Struts2 + Spring + Hibernate)、javascript脚本控制和Ajax异步交互等技术来开发。结构上分为表现层、业务层和数据访问层。其中表现层采用Struts框架开发;业务层封装业务流程,为适应...
数据库课程设计报告 题 目 飞机订票管理系统 目录 第一章 概述 2 1.1项目背景 2 1.2 编写目的 2 1.3 开发工具 3 1.3.1软件定义 3 1.3.2 开发环境 3 第二章 需求分析 3 2.1 问题陈述 3 2.2 ER模型图 3 第三章 数据库...
HTTP请求动作通过GitHub Actions创建HTTP请求。 该操作允许GitHub事件与使用HTTP API的工具(如Ansible AWX)互动。例子jobs : deployment : runs-on : ubuntu-latest steps : - name : Deploy Stage uses : ...
这是一个基于SSM(Spring、SpringMVC和MyBatis)框架与Vue.js前端技术的医院门诊管理系统。该系统旨在帮助医院提高管理效率,优化患者就诊流程,并为医务人员提供便捷的信息查询功能。源码:本资源包含完整的医院门诊...
模拟http请求 post get方式 pc版本 (卫士可能会报毒,信任就好)
extjs向action提交的方法,由Ext界面提交到action的两种方法,点击id为save的按钮时,执行loginFun函数。
Spring in Action CN.001<br>Spring in Action CN.002<br>Spring in Action CN.003<br>Spring in Action CN.004<br>Spring in Action CN.005<br>Spring in Action CN.006<br>Spring in Action ... <br>本书信息:...
本文整理了3种非表单请求action,需要注意的是第二种:action名都是在sturts.xml中配置的名字,有需求的朋友可以参考下哈,希望对你有所帮助
在实际的项目中,可能存在这样的情况:我们要通过Ajax访问Action中的某个方法,然后返回一个特定的数值给Ajax,而不是将方法处理结果对应的页面返回给Ajax;
js ajax请求实现 struts2 action js ajax请求实现 struts2 action js ajax请求实现 struts2 action js ajax请求实现 struts2 action js ajax请求实现 struts2 action
请求被ActionServlet(控制器)接收,它在struts- config.xml文件中寻找请求的URI,找到对应的Action类后,Action类执行相应的业务逻 辑。Action类执行建立在模型组件基础上的业务逻辑,模型组件是和应用程序关联的...
Spring最突出之处在于它使企业级系统开发变得简单,所以,企业级系统开发人员会更加欣赏《Spring in Action中文版》中的示例代码。《Spring in Action中文版》最后4章描述了Spring是如何为Web层开发提供支持的,如果...
document.postform.action = SaveReturnInfo; 提交form表单 document.getElementById(postform).submit(); 以上就是小编为大家带来的js 提交form表单和设置form表单请求路径的实现方法全部内容了,希望大家多多支持...
提供IN Action系列的技术教材:Spring.in.Action.3rd,Restlet in Action,OSGi in Action等等。
NULL 博文链接:https://cdxs2.iteye.com/blog/1925245