org.apache.shiro.web.session.mgt.WebSessionContext Java Examples
The following examples show how to use
org.apache.shiro.web.session.mgt.WebSessionContext.
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: OnlineSessionFactory.java From supplierShop with MIT License | 6 votes |
@Override public Session createSession(SessionContext initData) { OnlineSession session = new OnlineSession(); if (initData != null && initData instanceof WebSessionContext) { WebSessionContext sessionContext = (WebSessionContext) initData; HttpServletRequest request = (HttpServletRequest) sessionContext.getServletRequest(); if (request != null) { UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); // 获取客户端操作系统 String os = userAgent.getOperatingSystem().getName(); // 获取客户端浏览器 String browser = userAgent.getBrowser().getName(); session.setHost(IpUtils.getIpAddr(request)); session.setBrowser(browser); session.setOs(os); } } return session; }
Example #2
Source File: OnlineSessionFactory.java From ruoyiplus with MIT License | 6 votes |
@Override public Session createSession(SessionContext initData) { OnlineSession session = new OnlineSession(); if (initData != null && initData instanceof WebSessionContext) { WebSessionContext sessionContext = (WebSessionContext) initData; HttpServletRequest request = (HttpServletRequest) sessionContext.getServletRequest(); if (request != null) { UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); // 获取客户端操作系统 String os = userAgent.getOperatingSystem().getName(); // 获取客户端浏览器 String browser = userAgent.getBrowser().getName(); session.setHost(IpUtils.getIpAddr(request)); session.setBrowser(browser); session.setOs(os); } } return session; }
Example #3
Source File: OnlineSessionFactory.java From RuoYi with Apache License 2.0 | 6 votes |
@Override public Session createSession(SessionContext initData) { OnlineSession session = new OnlineSession(); if (initData instanceof WebSessionContext) { WebSessionContext sessionContext = (WebSessionContext) initData; HttpServletRequest request = (HttpServletRequest) sessionContext.getServletRequest(); if (request != null) { UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); // 获取客户端操作系统 String os = userAgent.getOperatingSystem().getName(); // 获取客户端浏览器 String browser = userAgent.getBrowser().getName(); session.setHost(IpUtils.getIpAddr(request)); session.setBrowser(browser); session.setOs(os); } } return session; }
Example #4
Source File: OnlineSessionFactory.java From LuckyFrameWeb with GNU Affero General Public License v3.0 | 6 votes |
@Override public Session createSession(SessionContext initData) { OnlineSession session = new OnlineSession(); if (initData instanceof WebSessionContext) { WebSessionContext sessionContext = (WebSessionContext) initData; HttpServletRequest request = (HttpServletRequest) sessionContext.getServletRequest(); if (request != null) { UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); // 获取客户端操作系统 String os = userAgent.getOperatingSystem().getName(); // 获取客户端浏览器 String browser = userAgent.getBrowser().getName(); session.setHost(IpUtils.getIpAddr(request)); session.setBrowser(browser); session.setOs(os); } } return session; }
Example #5
Source File: UpmsSessionFactory.java From zheng with MIT License | 5 votes |
@Override public Session createSession(SessionContext sessionContext) { UpmsSession session = new UpmsSession(); if (null != sessionContext && sessionContext instanceof WebSessionContext) { WebSessionContext webSessionContext = (WebSessionContext) sessionContext; HttpServletRequest request = (HttpServletRequest) webSessionContext.getServletRequest(); if (null != request) { session.setHost(request.getRemoteAddr()); session.setUserAgent(request.getHeader("User-Agent")); } } return session; }
Example #6
Source File: OnlineSessionFactory.java From es with Apache License 2.0 | 5 votes |
@Override public Session createSession(SessionContext initData) { OnlineSession session = new OnlineSession(); if (initData != null && initData instanceof WebSessionContext) { WebSessionContext sessionContext = (WebSessionContext) initData; HttpServletRequest request = (HttpServletRequest) sessionContext.getServletRequest(); if (request != null) { session.setHost(IpUtils.getIpAddr(request)); session.setUserAgent(request.getHeader("User-Agent")); session.setSystemHost(request.getLocalAddr() + ":" + request.getLocalPort()); } } return session; }