本文整理汇总了Java中org.apache.commons.lang3.StringUtils.isAnyBlank方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isAnyBlank方法的具体用法?Java StringUtils.isAnyBlank怎么用?Java StringUtils.isAnyBlank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.isAnyBlank方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: authGet
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@GetMapping(produces = "text/plain;charset=utf-8")
public String authGet(
@RequestParam(name = "signature", required = false) String signature,
@RequestParam(name = "timestamp", required = false) String timestamp,
@RequestParam(name = "nonce", required = false) String nonce,
@RequestParam(name = "echostr", required = false) String echostr) {
this.logger.info("\n接收到来自微信服务器的认证消息:[{}, {}, {}, {}]", signature,
timestamp, nonce, echostr);
if (StringUtils.isAnyBlank(signature, timestamp, nonce, echostr)) {
throw new IllegalArgumentException("请求参数非法,请核实!");
}
if (this.wxService.checkSignature(timestamp, nonce, signature)) {
return echostr;
}
return "非法请求";
}
示例2: Homeserver
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Homeserver(HomeserverState state) {
if (StringUtils.isAnyBlank(state.getAppName(), state.getAppVersion())) {
throw new IllegalArgumentException("Application name and version must be set");
}
this.state = state;
log.info("Homeserver is {}/{}", state.getAppName(), state.getAppVersion());
}
示例3: resetCorrectOffsets
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 按上次记录重置offsets
*/
private void resetCorrectOffsets() {
String kafkaServers = consumerContext.getProperties().getProperty("bootstrap.servers");
String zkServers = consumerContext.getProperties().getProperty("zookeeper.connect");
if (StringUtils.isAnyBlank(kafkaServers, zkServers)) {
logger.warn(
"resetCorrectOffsets exit。Please check [bootstrap.servers] and [zookeeper.connect] is existing");
return;
}
ZkConsumerCommand command = new ZkConsumerCommand(zkServers, kafkaServers);
try {
List<String> topics = command.getSubscribeTopics(consumerContext.getGroupId());
for (String topic : topics) {
List<TopicPartitionInfo> partitions = command
.getTopicOffsets(consumerContext.getGroupId(), topic);
for (TopicPartitionInfo partition : partitions) {
//期望的偏移
long expectOffsets = consumerContext.getLatestProcessedOffsets(topic,
partition.getPartition());
//
if (expectOffsets >= 0 && expectOffsets < partition.getOffset()) {
command.resetTopicOffsets(consumerContext.getGroupId(), topic,
partition.getPartition(), expectOffsets);
logger.info("seek Topic[{}] partition[{}] from {} to {}", topic,
partition.getPartition(), partition.getOffset(), expectOffsets);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
command.close();
}
示例4: login
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public User login(String name, String password) throws ServiceException {
if (StringUtils.isAnyBlank(name, password)) {
throw new ServiceException("用户名或密码不能为空!");
}
User user = userDao.findByName(name);
if (StringUtils.equals(user.getPassword(), password)) {
return user;
}
throw new ServiceException("用户名或密码错误,登录失败");
}
示例5: add
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public synchronized static void add(String key, String value) {
if (StringUtils.isAnyBlank(key, value)) { return; }
allProperties.put(key, value);
}
示例6: validateCaptcha
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 验证验证码
*
* @param paraName 验证码参数
*/
public boolean validateCaptcha(String paraName) {
String captcha = request.getParameter(paraName);
String captchaKey = KaptchaExtend.getCaptcha(request);
logger.debug("captcha:{}, captchaKey:{}", captcha, captchaKey);
if (StringUtils.isAnyBlank(captcha, captchaKey)) {
return false;
}
if (StringUtils.equalsIgnoreCase(captcha, captchaKey)) {
KaptchaExtend.removeCaptcha(request.getSession());
return true;
}
return false;
}