您的位置:首页 > 理论基础 > 计算机网络

js实现https与http之间的转换

2015-01-08 10:05 513 查看
<pre name="code" class="javascript">js实现https与http之间的转换

<%
String context_1 = request.getContextPath();
int port = request.getServerPort();
String context = "";
String httpsPath = "";
if(port==80 || port==443){
context = "http://" + request.getServerName() +  context_1;
httpsPath = "https://" + request.getServerName() +  context_1;
} else {
context = "http://" + request.getServerName() + ":" + port  + "" +  context_1;
httpsPath = "https://" + request.getServerName() + ":" + port  + "" +  context_1;
}
%>

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐