*/
@Override
public boolean preHandle(javax.servlet.http.HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
final String mobil = "detectedDevice";
final Device device = deviceResolver.resolveDevice(request);
final UserAgentStringParser parser = UADetectorServiceFactory.getResourceModuleParser();
final UserAgent agent = parser.parse(request.getHeader("User-Agent"));
log.trace("user agent --->" + agent.toString());
request.setAttribute("so", agent.getOperatingSystem().getFamily());
request.setAttribute("bo_vendor", agent.getProducer());
request.setAttribute("agent_type", agent.getTypeName());
request.setAttribute("agent_name", agent.getName());
request.setAttribute("agent_family", agent.getFamily());
request.setAttribute("agent_pro_url", agent.getProducerUrl());
request.setAttribute("bo_vendor_ver", agent.getVersionNumber().getMajor());
final Boolean enabledMobileDevice = EnMePlaceHolderConfigurer
.getBooleanProperty("application.mobile.enabled");
final Boolean forceMobileDevice = EnMePlaceHolderConfigurer
.getBooleanProperty("application.mobile.only");
log.trace(" enabledMobileDevice => "+enabledMobileDevice);
log.trace(" forceMobileDevice => "+forceMobileDevice);
// if is mobile device and if mobile supoort is enabled
if (enabledMobileDevice && device.isMobile()) {
//force to use mobile view.
request.setAttribute(mobil, device.isMobile());
log.trace(" forceMobileDevice => 1");
// force to be a mobile device
} else if (forceMobileDevice) {
request.setAttribute(mobil, Boolean.TRUE);
log.trace(" forceMobileDevice => 2");
// if is a tablet and is not forced to be mobile
} else if (!forceMobileDevice && device.isTablet()) {
request.setAttribute(mobil, Boolean.TRUE);
log.trace(" forceMobileDevice => 3");
// if is normal (NO MOBILE AND TABLE) and is not force to be a mobile device
} else if (!forceMobileDevice && device.isNormal()) {
request.setAttribute(mobil, Boolean.FALSE);
log.trace(" forceMobileDevice => 4");
// another options, display always NON mobile site
} else {
request.setAttribute(mobil, Boolean.FALSE);