當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。