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;
	}		
%>

 

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐