本文整理汇总了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;
}
示例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;
// }
// });
}
}
示例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;
}