<%
String htm = "/gas/index.html";
String wap = "/wap/index.wml";
String wap2 = "/wap2/index.xhtml";
String agent = request.getHeader("user-agent");
String accep = request.getHeader("accept");
boolean isWAP = false;
if (accep.toLowerCase().indexOf("vnd.wap.wml")>0){
isWAP = true;
}else{
String brow = agent.substring(0,4);
if (
brow.equals("Noki") ||
brow.equals("Eric") ||
brow.equals("R380") ||
brow.equals("MOT-") ||
brow.equals("UPG1") ||
brow.equals("Jing") ||
brow.equals("Acoo") ||
brow.equals("Wapt") ||
brow.equals("QWAP") ||
brow.equals("m-cr") ||
brow.equals("MC21") ||
brow.equals("Your") ||
brow.equals("YOUR") ||
brow.equals("w@pS") ||
brow.equals("Alca") ||
brow.equals("wapw") ||
brow.equals("Rain") ||
brow.equals("Java") ||
brow.equals("AUR ") ||
brow.equals("UP.B") ||
brow.equals("WAPm") ||
brow.equals("WinW") ||
brow.equals("WapI") ||
brow.equals("WAPJ") ||
brow.equals("WapV") ||
brow.equals("4thp") ||
brow.equals("Waps") ||
brow.equals("Mits") ||
brow.equals("SIE-") ||
brow.equals("Aptu") ||
brow.equals("WmlS") ||
brow.equals("Wapa")){
isWAP = true;
}
}
boolean isWAP2 = false;
if (isWAP){
if (accep.toLowerCase().indexOf("xhtml")>0){
isWAP2 = true;
}
}
if (isWAP2){
response.sendRedirect(wap2);
}else if (isWAP){
response.sendRedirect(wap);
}else{
response.sendRedirect(htm);
}
%>