关注于系统高可用、网站架构
分类: 系统运维
2010-02-25 15:32:25
在ROOT应用的写个jsp文件,暂定义为a.jsp,加入以下代码
<%@ page import="java.net.HttpURLConnection, java.net.URL, javax.net.ssl.*, java.security.*" %>
<%
String requestedURL = request.getRequestURL().toString();
int responseCode = -1;
String fileName = null;
URL url = new URL(requestedURL+"/admin");//modifyinggggg
if(request.isSecure())
{
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, null, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
// Create a HostNameVerifier to verify nothing ...
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hv);
} catch (Exception e) {
}
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
try
{
con.connect();
responseCode = con.getResponseCode();
}
catch(Exception e)
{
// do nothing here as the exception can occur even when the functionality is proper.
}
}
else
{
HttpURLConnection con = (HttpURLConnection) url.openConnection();
try
{
con.connect();
responseCode = con.getResponseCode();
}
catch(Exception e)
{
// do nothing here as the exception can occur even when the functionality is proper.
}
}
if( responseCode >= 400 )//logggg
{
fileName = "/default.jsp";
}
else
{
//设定指定的路径
fileName = "/easycrm";
}
response.sendRedirect(fileName);
%>
然后,修改$tomcat/conf/web.xml文件。
在web.xml文件中,有一段如下:
在
重启tomcat,访问会自动跳转到webapp下easycrm目录中