在Abriza开发过程中需要对MyAccount页面进行加密,实际上是为了确保账户信息的安全性.
目标:网站中的其他非加密页面还是采用http协议,端口号8080,加密页面采用https页面,端口号8443.
首先,你必须在本地配置SSL.这方面的资料网上也很多,我就不做介绍了.
其次,安装好SSL之后,你需要在本地的Tomcat中进行相关信息的配置,这方面的知识,网上也很多,大家可以在网上搜索学习.
最后,我主要说一下,怎样在我们的web项目中配置ssl.一开始,我也很困惑,之前从未做过这方面的东西.
当然程序员最基本的一项技能就是,疯狂的查看国外的一些网站,查看api文档信息.
所以在最后还是做出来了,甚是欣慰,要知道,大家都在等这块的东西啊..
解决方案,很简单,可能大家在配环境那块需要花费比较多的时间.我们可以采用SpringSource里面的security来对项目中的URL做一定的处理.
解决方案如下:
1 <port-mappings>
2 <port-mapping http="8080" https="8443"/>
3 </port-mappings>
4 <intercept-url pattern="/aaa/bbb" requires-channel="https"/>
5 <!-- some js information -->
6 <intercept-url pattern="/resources/js/jquery-1.4.4.min.js" requires-channel="any"/>
7 <intercept-url pattern="/resources/js/veil.js" requires-channel="any"/>
8 <!-- deal with other urls -->
9 <intercept-url pattern="/**" requires-channel="http"/>
是不是感觉很简单..结果很简单,过程值得学习.
其实一开始的问题在于js不知道怎么在http和https下共享,最后发现了在requires-channel中还有一个参数是any,顾名思义,在http和https下是可以共享的.
jack.lee-2012.02.24
pm 17:00
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.