Java Code Examples for org.springframework.mobile.device.Device#isNormal()

The following examples show how to use org.springframework.mobile.device.Device#isNormal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AccessSourceDeviceManage.java    From bbs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 访问设备
 * @param request
 * @return pc:电脑 wap:移动设备
 */
public String accessDevices(HttpServletRequest request) {
	SystemSetting systemSetting = settingService.findSystemSetting_cache();
	if(systemSetting.getSupportAccessDevice() != null){
		if(systemSetting.getSupportAccessDevice().equals(2)){
			return "pc";//电脑端
		}else if(systemSetting.getSupportAccessDevice().equals(3)){
			return "wap";//移动设备
		}
	}

	Device device = deviceResolver.resolveDevice(request);
	if(device.isNormal()){
		return "pc";//电脑
	}else{
		return "wap";//移动设备
	}
}
 
Example 2
Source File: JwtTokenUtil.java    From spring-security-mybatis-demo with Apache License 2.0 5 votes vote down vote up
private String generateAudience(Device device) {
    String audience = AUDIENCE_UNKNOWN;
    if (device.isNormal()) {
        audience = AUDIENCE_WEB;
    } else if (device.isTablet()) {
        audience = AUDIENCE_TABLET;
    } else if (device.isMobile()) {
        audience = AUDIENCE_MOBILE;
    }
    return audience;
}
 
Example 3
Source File: JwtTokenUtil.java    From xmanager with Apache License 2.0 5 votes vote down vote up
private String generateAudience(Device device) {
    String audience = AUDIENCE_UNKNOWN;
    if (device.isNormal()) {
        audience = AUDIENCE_WEB;
    } else if (device.isTablet()) {
        audience = AUDIENCE_TABLET;
    } else if (device.isMobile()) {
        audience = AUDIENCE_MOBILE;
    }
    return audience;
}
 
Example 4
Source File: _JwtTokenUtil.java    From generator-spring-rest-jwt with MIT License 5 votes vote down vote up
private String generateAudience(Device device) {
    String audience = AUDIENCE_UNKNOWN;
    if (device.isNormal()) {
        audience = AUDIENCE_WEB;
    } else if (device.isTablet()) {
        audience = AUDIENCE_TABLET;
    } else if (device.isMobile()) {
        audience = AUDIENCE_MOBILE;
    }
    return audience;
}
 
Example 5
Source File: JwtTokenUtil.java    From microservices-sample-project with Apache License 2.0 5 votes vote down vote up
private String generateAudience(Device device) {
    String audience = AUDIENCE_UNKNOWN;
    if (device.isNormal()) {
        audience = AUDIENCE_WEB;
    } else if (device.isTablet()) {
        audience = AUDIENCE_TABLET;
    } else if (device.isMobile()) {
        audience = AUDIENCE_MOBILE;
    }
    return audience;
}
 
Example 6
Source File: JwtTokenUtil.java    From tour-of-heros-api-security-zerhusen with MIT License 5 votes vote down vote up
private String generateAudience(Device device) {
    String audience = AUDIENCE_UNKNOWN;
    if (device.isNormal()) {
        audience = AUDIENCE_WEB;
    } else if (device.isTablet()) {
        audience = AUDIENCE_TABLET;
    } else if (device.isMobile()) {
        audience = AUDIENCE_MOBILE;
    }
    return audience;
}
 
Example 7
Source File: TokenHelper.java    From springboot-jwt-starter with MIT License 5 votes vote down vote up
private String generateAudience(Device device) {
    String audience = AUDIENCE_UNKNOWN;
    if (device.isNormal()) {
        audience = AUDIENCE_WEB;
    } else if (device.isTablet()) {
        audience = AUDIENCE_TABLET;
    } else if (device.isMobile()) {
        audience = AUDIENCE_MOBILE;
    }
    return audience;
}
 
Example 8
Source File: TokenUtils.java    From Cerberus with MIT License 5 votes vote down vote up
private String generateAudience(Device device) {
  String audience = this.AUDIENCE_UNKNOWN;
  if (device.isNormal()) {
    audience = this.AUDIENCE_WEB;
  } else if (device.isTablet()) {
    audience = AUDIENCE_TABLET;
  } else if (device.isMobile()) {
    audience = AUDIENCE_MOBILE;
  }
  return audience;
}
 
Example 9
Source File: IndexController.java    From tutorials with MIT License 5 votes vote down vote up
@GetMapping("/")
public String greeting(Device device) {

	String deviceType = "browser";
	String platform = "browser";
	String viewName = "index";

	if (device.isNormal()) {
		deviceType = "browser";
	} else if (device.isMobile()) {
		deviceType = "mobile";
		viewName = "mobile/index";
	} else if (device.isTablet()) {
		deviceType = "tablet";
		viewName = "tablet/index";
	}

	platform = device.getDevicePlatform().name();

	if (platform.equalsIgnoreCase("UNKNOWN")) {
		platform = "browser";
	}

	LOGGER.info("Client Device Type: " + deviceType + ", Platform: " + platform);

	return viewName;
}