List of usage examples for javax.servlet.http HttpSession getAttribute
public Object getAttribute(String name);
null
if no object is bound under the name. From source file:net.naijatek.myalumni.util.utilities.ParamUtil.java
public static String getAttribute(final HttpSession session, final String name) { String ret = (String) session.getAttribute(name); if (ret == null) { ret = ""; }/* w w w .j a va 2 s .co m*/ return ret.trim(); }
From source file:com.liusoft.dlog4j.UserLoginManager.java
/** * //w w w .j av a2 s . com * * @param req * @param res * @param ubean * @param keepDays * @see com.liusoft.dlog4j.action.UserAction#doLogin(ActionMapping, * ActionForm, HttpServletRequest, HttpServletResponse) */ public static SessionUserObject loginUser(HttpServletRequest req, HttpServletResponse res, UserBean ubean, int keepDays) { HttpSession ssn = req.getSession(false); if (ssn != null) { SessionUserObject rub = (SessionUserObject) ssn.getAttribute(SESSION_USER_KEY); if (rub != null && rub.getId() == ubean.getId()) { return rub; } } // ??,?? ubean.setLastAddr(req.getRemoteAddr()); ubean.setLastTime(new Timestamp(System.currentTimeMillis())); ubean.setKeepDays(keepDays); ubean.setOnlineStatus(1); DLOGUserManager.update(ubean); // ?cookie,?session? UUID uuid = new UUID(); uuid.uid = ubean.getId(); uuid.pwdCode = ubean.getPassword().hashCode(); uuid.host = req.getRemoteAddr(); String value = uuid.toString(); RequestUtils.setCookie(req, res, COOKIE_UUID_KEY, value, (keepDays > 0) ? keepDays * 86400 : -1); RequestUtils.setCookie(req, res, COOKIE_LASTLOGIN_KEY, ubean.getLastTime().toString(), -1); // ?Session if (ssn == null) ssn = req.getSession(true); if (ssn != null && ubean != null) { ssn.setAttribute(SESSION_USER_KEY, SessionUserObject.copyFrom(ubean)); } return ubean; }
From source file:com.amalto.webapp.core.bean.Configuration.java
private static Configuration loadFromSession() { HttpSession session = SessionContextHolder.currentSession(); if (session != null) { if (LOG.isDebugEnabled()) { LOG.debug("Getting registered configuration from session " + session.getId()); //$NON-NLS-1$ }//from www . j a v a 2s . com return (Configuration) session.getAttribute(MDM_CONFIGURATION_ATTRIBUTE); } return null; }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
public static String getPassword() { HttpSession sStore = RWT.getRequest().getSession(); return (String) sStore.getAttribute(NAME.LOGIN_PASSWORD.name()); }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
public static String getName() { HttpSession sStore = RWT.getRequest().getSession(); return (String) sStore.getAttribute(NAME.LOGIN_NAME.name()); }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
public static String getIsRegistDB() { HttpSession sStore = RWT.getRequest().getSession(); return (String) sStore.getAttribute(NAME.IS_REGIST_DB.name()); }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
public static String getIsSharedDB() { HttpSession sStore = RWT.getRequest().getSession(); return (String) sStore.getAttribute(NAME.IS_SHARED_DB.name()); }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
public static String getUseOTP() { HttpSession sStore = RWT.getRequest().getSession(); return (String) sStore.getAttribute(NAME.USE_OTP.name()); }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
public static String getOTPSecretKey() { HttpSession sStore = RWT.getRequest().getSession(); return (String) sStore.getAttribute(NAME.OTP_SECRET_KEY.name()); }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
public static String getLangeage() { HttpSession sStore = RWT.getRequest().getSession(); return (String) sStore.getAttribute(NAME.LANGUAGE.name()); }