我想在jsp中將我的頁面http://
重定向到https://
。http轉換爲https轉到無限循環
我對我有一些代碼,但它給出了一些問題。
<%
String req_protocol = request.getProtocol().toLowerCase();
String convertHttps = req_protocol.substring(0, req_protocol.indexOf("/")).toLowerCase();
if(convertHttps.equals("http")){
response.sendRedirect("https://xyz.com/signup/signup.jsp");
}
%>
它給出錯誤頁面爲「無限循環」。
使用的isSecure(),以確定其是否使用https http://download.oracle.com/docs/cd/E17802_01/products/products/servlet/2.3/javadoc/javax/servlet/ServletRequest.html#isSecure () – Vjy 2010-12-15 15:01:43
使用fiddler2或類似方法捕獲實際的響應並將其發佈到此處。代碼看起來不錯 - 它是你正在運行的實際代碼嗎? – 2010-12-15 15:01:59