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


Java StringUtils.hasLength方法代码示例

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


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

示例1: getCacheKey

import org.apache.shiro.util.StringUtils; //导入方法依赖的package包/类
protected Object getCacheKey(String prefix, PrincipalCollection principals) {
	Object userObject = getAvailablePrincipal(principals);
	if (userObject == null) {
		return principals;
	}

	String userId = null;
	if (userObject instanceof SecurityUser) {
		SecurityUser shiroUser = (SecurityUser) userObject;
		userId = shiroUser.getUserId();
	}

	if (StringUtils.hasLength(userId)) {
		return prefix + userId;
	}

	return principals;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:19,代码来源:SecurityAuthorizingRealm.java

示例2: doFilterInternal

import org.apache.shiro.util.StringUtils; //导入方法依赖的package包/类
@Override
	protected void doFilterInternal(ServletRequest servletRequest, ServletResponse servletResponse,
			final FilterChain chain) throws ServletException, IOException {
//		final ServletRequest request = prepareServletRequest(servletRequest, servletResponse, chain);
//		final ServletResponse response = prepareServletResponse(request, servletResponse, chain);
		boolean filter = true;
		if (StringUtils.hasLength(filterUrl)) {
			String[] filterUrls = filterUrl.split(",");
			int length = filterUrls.length;
			for (int i = 0; i < length; i++) {
				String url = filterUrls[i];
				if (pathsMatch(url, servletRequest)) {
					filter = false;
					//executeChain(request, response, chain);
					 chain.doFilter(servletRequest, servletResponse);
					break;
				}
			}
		}
		if (filter) {
			super.doFilterInternal(servletRequest, servletResponse, chain);
			// final Subject subject = createSubject(request, response);
			// // noinspection unchecked
			// subject.execute(new Callable() {
			// public Object call() throws Exception {
			// updateSessionLastAccessTime(request, response);
			// executeChain(request, response, chain);
			// return null;
			// }
			// });
		}
	}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:33,代码来源:AbstractSecurityFilter.java

示例3: fromResourcePath

import org.apache.shiro.util.StringUtils; //导入方法依赖的package包/类
/**
 * Creates a new {@code Ini} instance loaded with the INI-formatted data in the resource at the given path.  The
 * resource path may be any value interpretable by the
 * {@link ResourceUtils#getInputStreamForPath(String) ResourceUtils.getInputStreamForPath} method.
 *
 * @param resourcePath the resource location of the INI data to load when creating the {@code Ini} instance.
 * @return a new {@code Ini} instance loaded with the INI-formatted data in the resource at the given path.
 * @throws ConfigurationException if the path cannot be loaded into an {@code Ini} instance.
 */
public static Ini fromResourcePath(String resourcePath) throws ConfigurationException {
    if (!StringUtils.hasLength(resourcePath)) {
        throw new IllegalArgumentException("Resource Path argument cannot be null or empty.");
    }
    Ini ini = new Ini();
    ini.loadFromPath(resourcePath);
    return ini;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:18,代码来源:Ini.java


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