Java Code Examples for org.springframework.web.context.request.ServletWebRequest#getHeader()

The following examples show how to use org.springframework.web.context.request.ServletWebRequest#getHeader() . 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: RedisValidateCodeRepository.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 获取请求头中DEVICE-ID的值,此值与客户端绑定,一端一码
 * @param type 验证码类型:sms or captcha
 */
private String buildKey(ServletWebRequest request, ValidateCodeType type) {
	String deviceId = request.getHeader("DEVICE-ID");
	if (StringUtils.isBlank(deviceId)) {
		throw new ValidateCodeException("请在请求头中携带DEVICE-ID参数");
	}
	return "code:" + type.toString().toLowerCase() + ":" + deviceId;
}
 
Example 2
Source File: RedisValidateCodeRepository.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 获取请求头中DEVICE-ID的值,此值与客户端绑定,一端一码
 * @param type 验证码类型:sms or captcha
 */
private String buildKey(ServletWebRequest request, ValidateCodeType type) {
	String deviceId = request.getHeader("DEVICE-ID");
	if (StringUtils.isBlank(deviceId)) {
		throw new ValidateCodeException("请在请求头中携带DEVICE-ID参数");
	}
	return "code:" + type.toString().toLowerCase() + ":" + deviceId;
}
 
Example 3
Source File: RedisValidateCodeRepository.java    From paascloud-master with Apache License 2.0 5 votes vote down vote up
private String buildKey(ServletWebRequest request, ValidateCodeType type) {
	String deviceId = request.getHeader("deviceId");
	if (StringUtils.isBlank(deviceId)) {
		throw new ValidateCodeException("请在请求头中携带deviceId参数");
	}
	return "code:" + type.toString().toLowerCase() + ":" + deviceId;
}
 
Example 4
Source File: RedisCodeService.java    From SpringAll with MIT License 5 votes vote down vote up
private String key(ServletWebRequest request, String mobile) throws Exception {
    String deviceId = request.getHeader("deviceId");
    if (StringUtils.isBlank(deviceId)) {
        throw new Exception("请在请求头中设置deviceId");
    }
    return SMS_CODE_PREFIX + deviceId + ":" + mobile;
}
 
Example 5
Source File: RedisCodeService.java    From SpringAll with MIT License 5 votes vote down vote up
private String key(ServletWebRequest request, String mobile) throws Exception {
    String deviceId = request.getHeader("deviceId");
    if (StringUtils.isBlank(deviceId)) {
        throw new Exception("请在请求头中设置deviceId");
    }
    return SMS_CODE_PREFIX + deviceId + ":" + mobile;
}