Hi guys - I've posted an article 2 years ago on developing a mobile web application by using the existing desktop application. You can read more here

X-WAP-PROFILE is not a full measure for us to decide the mobile user as the latest smartphone devices are not using this header. So, we need to look for another alternative. Here the technique is to identify the user based on the other headers called USER-AGENT and ACCEPT.

We can assure that 95% of mobile users can be detected by these 3 checks (X-WAP-PROFILE, USER-AGENT, ACCEPT).

Here the code snippet to identify the mobile users

MobileUtil.java

import javax.servlet.http.HttpServletRequest;

public class MobileUtil
{
public boolean detectMobileBrowser(HttpServletRequest request)
{
String[] mobileUAA = { "midp", "j2me", "avantg", "docomo", "novarra", "palmos", "palmsource", "240x320", "opwv", "chtml", "pda", "windows ce", "mmp/", "blackberry", "mib/", "symbian", "wireless", "nokia", "hand", "mobi", "phone", "cdm", "up.b", "audio", "SIE-", "SEC-", "samsung", "HTC", "mot-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "NEC", "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover", "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal", "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "moto", "webos" };
if (request.getHeader("X-WAP-PROFILE") != null)
{
return true;
}
else if (request.getHeader("user-agent") != null)
{
for (int i = 0; i < mobileUAA.length; i++)
{
if ((request.getHeader("user-agent").toLowerCase()).indexOf(mobileUAA[i]) != -1)
{
return true;
}
}
}
else if (request.getHeader("ACCEPT") != null && ((request.getHeader("ACCEPT")).toLowerCase()).indexOf("wap") != -1)
{
return true;
}
return false;
}
}
OK, how to take this mobile detection program into a real mobile website implementation... Checkout in my further posts...