当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.isNotBlank方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.StringUtils.isNotBlank方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isNotBlank方法的具体用法?Java StringUtils.isNotBlank怎么用?Java StringUtils.isNotBlank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.StringUtils的用法示例。


在下文中一共展示了StringUtils.isNotBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRemoteIp

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Pulls the remote IP from the current HttpServletRequest, or grabs the value
 * for the specified alternative attribute (say, for proxied requests).  Falls
 * back to providing the "normal" remote address if no value can be retrieved
 * from the specified alternative header value.
 * @param context the context
 * @return the remote ip
 */
private String getRemoteIp(@NotNull final RequestContext context) {
    final HttpServletRequest request = WebUtils.getHttpServletRequest(context);
    String userAddress = request.getRemoteAddr();
    logger.debug("Remote Address = {}", userAddress);

    if (StringUtils.isNotBlank(this.alternativeRemoteHostAttribute)) {

        userAddress = request.getHeader(this.alternativeRemoteHostAttribute);
        logger.debug("Header Attribute [{}] = [{}]", this.alternativeRemoteHostAttribute, userAddress);

        if (StringUtils.isBlank(userAddress)) {
            userAddress = request.getRemoteAddr();
            logger.warn("No value could be retrieved from the header [{}]. Falling back to [{}].",
                    this.alternativeRemoteHostAttribute, userAddress);
        }
    }
    return userAddress;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:27,代码来源:BaseSpnegoKnownClientSystemsFilterAction.java

示例2: doGetAuthorizationInfo

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
	SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
	Long userId = (Long) WebUtil.getCurrentUser();
	Parameter parameter = new Parameter("sysAuthorizeService", "queryPermissionByUserId").setId(userId);
	logger.info("{} execute queryPermissionByUserId start...", parameter.getNo());
	List<?> list = provider.execute(parameter).getList();
	logger.info("{} execute queryPermissionByUserId end.", parameter.getNo());
	for (Object permission : list) {
		if (StringUtils.isNotBlank((String) permission)) {
			// 添加基于Permission的权限信息
			info.addStringPermission((String) permission);
		}
	}
	// 添加用户权限
	info.addStringPermission("user");
	return info;
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:18,代码来源:Realm.java

示例3: viewInput

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@RequestMapping("/view.html")
public String viewInput(String orderId, ModelMap model) {
    MchNotify item = null;
    if(StringUtils.isNotBlank(orderId)) {
        item = mchNotifyService.selectMchNotify(orderId);
    }
    if(item == null) {
        item = new MchNotify();
        model.put("item", item);
        return "mch_notify/view";
    }
    JSONObject object = (JSONObject) JSON.toJSON(item);
    if(item.getCreateTime() != null) object.put("createTime", DateUtil.date2Str(item.getCreateTime()));
    if(item.getUpdateTime() != null) object.put("updateTime", DateUtil.date2Str(item.getUpdateTime()));
    if(item.getLastNotifyTime() != null) object.put("lastNotifyTime", DateUtil.date2Str(item.getLastNotifyTime()));
    model.put("item", object);
    return "mch_notify/view";
}
 
开发者ID:jmdhappy,项目名称:xxpay-master,代码行数:19,代码来源:MchNotifyController.java

示例4: execute

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Execute this job entry and return the result. In this case it means, just
 * set the result boolean in the Result class.
 * 
 * @param prev_result
 *            The result of the previous execution
 * @return The Result of the execution.
 */
public Result execute(Result prev_result, int nr) {
    boolean result = true;
    if(StringUtils.isNotBlank(className)){
        try {
            //实例化配置的类
            JobEntryEasyExpandRunBase kui = (JobEntryEasyExpandRunBase) Class.forName(
                    environmentSubstitute(className)).newInstance();
            kui.setJeku(this);
            result = kui.run();
        } catch (Exception e) {
            prev_result.setNrErrors(1);
            result = false;
            logError("运行失败,"+className+","+environmentSubstitute(configInfo), e);
        }
    }
    prev_result.setResult(result);
    return prev_result;
}
 
开发者ID:majinju,项目名称:KettleUtil,代码行数:27,代码来源:JobEntryEasyExpand.java

示例5: validate

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void validate(final Host bookmark, final String message, final LoginOptions options) throws LoginCanceledException {
    final Credentials credentials = bookmark.getCredentials();
    if(input.hasOption(TerminalOptionsBuilder.Params.username.name())) {
        credentials.setUsername(input.getOptionValue(TerminalOptionsBuilder.Params.username.name()));
    }
    if(input.hasOption(TerminalOptionsBuilder.Params.password.name())) {
        credentials.setPassword(input.getOptionValue(TerminalOptionsBuilder.Params.password.name()));
    }
    if(input.hasOption(TerminalOptionsBuilder.Params.identity.name())) {
        credentials.setIdentity(LocalFactory.get(input.getOptionValue(TerminalOptionsBuilder.Params.identity.name())));
    }
    if(StringUtils.isNotBlank(credentials.getUsername()) && StringUtils.isNotBlank(credentials.getPassword())) {
        return;
    }
    super.validate(bookmark, message, options);
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:18,代码来源:TerminalLoginService.java

示例6: getRemoteAddr

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * @param req
 * @return
 */
public static String getRemoteAddr(HttpServletRequest req) {
    String ip = req.getHeader("X-Forwarded-For");
    if (StringUtils.isNotBlank(ip)) {
        String[] ips = StringUtils.split(ip, ',');
        if (ips != null) {
            for (String tmpip : ips) {
                if (StringUtils.isBlank(tmpip))
                    continue;
                tmpip = tmpip.trim();
                if (isIPAddr(tmpip) && !tmpip.startsWith("10.") && !tmpip.startsWith("192.168.")
                        && !"127.0.0.1".equals(tmpip)) {
                    return tmpip.trim();
                }
            }
        }
    }
    ip = req.getHeader("x-real-ip");
    if (isIPAddr(ip))
        return ip;
    ip = req.getRemoteAddr();
    if (ip.indexOf('.') == -1)
        ip = "127.0.0.1";
    return ip;
}
 
开发者ID:zhaoqilong3031,项目名称:spring-cloud-samples,代码行数:29,代码来源:WebUtils.java

示例7: build

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public CacheControl build() {
	CacheControl cacheControl = new CacheControl(0, 0, 0, 0);
	
	if (StringUtils.isNotBlank(ageHeaderValue) && StringUtils.isNumeric(ageHeaderValue)) {
		cacheControl.setAge(Integer.parseInt(ageHeaderValue));
	}
	
	if (StringUtils.isNotBlank(cacheControlHeaderValue)) {
		cacheControl.setMaxAge(extract(maxAge));
		cacheControl.setWhileRevalidate(extract(whileRevalidate));
		cacheControl.setIfError(extract(ifError));
	}
	
	cacheControl.setExpiration();
	
	return cacheControl;
}
 
开发者ID:mercadolibre,项目名称:java-restclient,代码行数:18,代码来源:CacheControl.java

示例8: get

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String get() {
  StringBuilder sb = new StringBuilder();
  List<Projection> projections = getProjections();
  if (!projections.isEmpty()) {
    // create the object we are going to populate
    sb.append(tab(1)).append("Map<String, Object> response = new HashMap<>();").append(NEWLINE);

    // add any standard expressions
    sb.append(getExpressions(projections));

    sb.append(tab(2)).append("return response;").append(NEWLINE);
  }

  String s = sb.toString();

  if (StringUtils.isNotBlank(s)) {
    return TEMPLATE_SCRIPT.replace(SELECT_STAR, s);
  } else {
    return TEMPLATE_SCRIPT;
  }
}
 
开发者ID:glytching,项目名称:dragoman,代码行数:23,代码来源:GroovySelectClauseListener.java

示例9: findParameterApplyStatus

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Finds the parameter-apply-status of the named parameter group inside the dbInstance.
 */
public RdsParameterApplyStatus findParameterApplyStatus(DBInstance dbInstance, String paramGroupName)
{
  if (dbInstance != null && dbInstance.getDBParameterGroups() != null && StringUtils.isNotBlank(paramGroupName))
  {
    for (DBParameterGroupStatus paramGroupStatus : dbInstance.getDBParameterGroups())
    {
      if (StringUtils.equals(paramGroupName, paramGroupStatus.getDBParameterGroupName()))
      {
        return RdsParameterApplyStatus.fromString(paramGroupStatus.getParameterApplyStatus());
      }
    }
  }
  return null;
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:18,代码来源:RdsAnalyzer.java

示例10: doFilter

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public void doFilter(ServletRequest servletRequest, ServletResponse response, FilterChain chain)
    throws IOException, ServletException {
    HttpServletRequest request = (HttpServletRequest)servletRequest;
    boolean filter = DataUtil.isEmpty(PropertiesUtil.getString("token.filter.test"));
    String token = request.getHeader("UUID");
    logger.info("UUID==>" + token);
    if (StringUtils.isNotBlank(token)) {
        try {
            Token tokenInfo = TokenUtil.getTokenInfo(token);
            if (tokenInfo != null) {
                WebUtil.saveCurrentUser(request, tokenInfo.getValue());
                if (DataUtil.isNotEmpty(expire)) {
                    if (System.currentTimeMillis() - tokenInfo.getTime() > Long.valueOf(expire) * 1000) {
                        WebUtil.saveCurrentUser(request, null);
                    }
                }
            } else if (filter) {
                WebUtil.saveCurrentUser(request, null);
            }
        } catch (Exception e) {
            logger.error("token检查发生异常:", e);
        }
    } else if (filter) {
        WebUtil.saveCurrentUser(request, null);
    }
    String url = request.getRequestURI();
    if (isWhiteReq(url.toLowerCase())) {
        chain.doFilter(request, response);
    } else if (DataUtil.isEmpty(WebUtil.getCurrentUser(request)) && filter) {
        response.setContentType("text/html; charset=UTF-8");
        Map<String, Object> modelMap = InstanceUtil.newLinkedHashMap();
        modelMap.put("code", HttpCode.UNAUTHORIZED.value().toString());
        modelMap.put("msg", HttpCode.UNAUTHORIZED.msg());
        modelMap.put("timestamp", System.currentTimeMillis());
        String result = JSON.toJSONString(modelMap);
        logger.warn(url + " ====> " + result);
        PrintWriter out = response.getWriter();
        out.println(result);
        out.flush();
        out.close();
    } else {
        chain.doFilter(request, response);
    }
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:45,代码来源:TokenFilter.java

示例11: getColumnNameByProperty

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
static String getColumnNameByProperty(final String propertyName, final Field[] properties) {
    Field matchProperty = getPropertyField(propertyName, properties);
    Column column = getColumnByProperty(propertyName, properties);
    if (column != null && StringUtils.isNotBlank(column.name())) {
        return column.name();
    }


    String usePropertyName = matchProperty.getName();
    return camelCaseToUnderscore(usePropertyName);
}
 
开发者ID:wz2cool,项目名称:mybatis-dynamic-query,代码行数:12,代码来源:EntityHelper.java

示例12: create

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void create(final int subscription) throws Exception {
	final Map<String, String> parameters = subscriptionResource.getParameters(subscription);
	final String group = parameters.get(IdentityResource.PARAMETER_GROUP);
	final String parentGroup = parameters.get(IdentityResource.PARAMETER_PARENT_GROUP);
	final String ou = parameters.get(IdentityResource.PARAMETER_OU);
	final Project project = subscriptionRepository.findOne(subscription).getProject();
	final String pkey = project.getPkey();

	// Check the relationship between group, OU and project
	validateGroup(group, ou, pkey);

	// Check the relationship between group, and parent
	final String parentDn = validateAndCreateParent(group, parentGroup, ou, pkey);

	// Create the group inside the parent (OU or parent CN)
	final String groupDn = "cn=" + group + "," + parentDn;
	log.info("New Group CN would be created {} project {} and subscription {}", group, pkey);
	final GroupLdapRepository repository = getGroup();
	final GroupOrg groupLdap = repository.create(groupDn, group);

	// Complete as needed the relationship between parent and this new group
	if (StringUtils.isNotBlank(parentGroup)) {
		// This group will be added as "uniqueMember" of its parent
		repository.addGroup(groupLdap, parentGroup);
	}

	// Associate the project to this group in the cache
	final CacheProjectGroup projectGroup = new CacheProjectGroup();
	projectGroup.setProject(project);
	projectGroup.setGroup(repository.getCacheRepository().findOneExpected(groupLdap.getId()));
	cacheProjectGroupRepository.saveAndFlush(projectGroup);
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:34,代码来源:LdapPluginResource.java

示例13: build

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public WxMpXmlOutTransferKefuMessage build() {
  WxMpXmlOutTransferKefuMessage m = new WxMpXmlOutTransferKefuMessage();
  setCommon(m);
  if(StringUtils.isNotBlank(this.kfAccount)){
    WxMpXmlOutTransferKefuMessage.TransInfo transInfo = new WxMpXmlOutTransferKefuMessage.TransInfo();
    transInfo.setKfAccount(this.kfAccount);
    m.setTransInfo(transInfo);
  }
  return m;
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:12,代码来源:TransferCustomerServiceBuilder.java

示例14: run

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void run() {
    if (StringUtils.isBlank(editable.toString()))
        return;

    BUser user = BNetworkManager.sharedManager().getNetworkAdapter().currentUserModel();
    String metadata = user.metaStringForKey(metaKey);

    if (StringUtils.isNotBlank(metadata) && metadata.equals(editable.toString()))
        return;

    user.setMetadataString(metaKey, editable.toString());
    BNetworkManager.sharedManager().getNetworkAdapter().pushUser();
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:15,代码来源:SaveDetailTextWatcher.java

示例15: qqCallback

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@RequestMapping("/callback/qq")
public String qqCallback(HttpServletRequest request, ModelMap modelMap) {
	String host = request.getHeader("host");
	try {
		String code = request.getParameter("code");
		if (StringUtils.isNotBlank(code)) {// 如果不为空
			// 获取token和openid
			Map<String, String> map = ThirdPartyLoginHelper.getQQTokenAndOpenid(code, host);
			String openId = map.get("openId");
			if (StringUtils.isNotBlank(openId)) {// 如果openID存在
				// 获取第三方用户信息存放到session中
				ThirdPartyUser thirdUser = ThirdPartyLoginHelper.getQQUserinfo(map.get("access_token"), openId);
				thirdUser.setProvider("QQ");
				thirdPartyLogin(request, thirdUser);
				// 跳转到登录成功界面
				modelMap.put("retUrl", Resources.THIRDPARTY.getString("third_login_success"));
			} else {// 如果未获取到OpenID
				modelMap.put("retUrl", "-1");
			}
		} else {// 如果没有返回令牌,则直接返回到登录页面
			modelMap.put("retUrl", "-1");
		}
	} catch (Exception e) {
		modelMap.put("retUrl", "-1");
		e.printStackTrace();
	}

	return "/sns/redirect";
}
 
开发者ID:babymm,项目名称:mumu,代码行数:30,代码来源:ThirdPartyLoginController.java


注:本文中的org.apache.commons.lang3.StringUtils.isNotBlank方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。