Java Code Examples for org.springframework.web.context.request.ServletRequestAttributes#getAttributeNames()

The following examples show how to use org.springframework.web.context.request.ServletRequestAttributes#getAttributeNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RequestHolder.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
/**
 * 获取所有session key
 *
 * @return String[]
 */
public static String[] getSessionKeys() {
    log.debug("getSessionKeys -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
    ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
    if (null == servletRequestAttributes) {
        return null;
    }
    return servletRequestAttributes.getAttributeNames(RequestAttributes.SCOPE_SESSION);
}
 
Example 2
Source File: RequestHolder.java    From springboot-shiro with MIT License 5 votes vote down vote up
/**
 * 获取所有session key
 *
 * @return String[]
 */
public static String[] getSessionKeys() {
    log.debug("getSessionKeys -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
    ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
    if (null == servletRequestAttributes) {
        return null;
    }
    return servletRequestAttributes.getAttributeNames(RequestAttributes.SCOPE_SESSION);
}
 
Example 3
Source File: RequestHolder.java    From OneBlog with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 获取所有session key
 *
 * @return String[]
 */
public static String[] getSessionKeys() {
    log.debug("getSessionKeys -- Thread id :{}, name : {}", Thread.currentThread().getId(), Thread.currentThread().getName());
    ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
    if (null == servletRequestAttributes) {
        return null;
    }
    return servletRequestAttributes.getAttributeNames(RequestAttributes.SCOPE_SESSION);
}