我想在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