Example #1
0
 public static void setUserSession(HttpServletRequest request, String propertyName, Object obj) {
   UserSession gus = (UserSession) WebUtils.getSessionAttribute(request, Constant.SESS_USER);
   if (propertyName.equals(PROPERTY_USER)) gus.setUser((User) obj);
   else if (propertyName.equals(PROPERTY_LOGIN)) gus.setLogin((Integer) obj);
   else if (propertyName.equals(PROPERTY_BOX_LIST)) gus.setBoxList((List) obj);
   else if (propertyName.equals(PROPERTY_SEARCH)) gus.setSearchKey((String) obj);
 }
Example #2
0
 public static Object getUserSession(HttpServletRequest request, String propertyName) {
   UserSession gus = (UserSession) WebUtils.getSessionAttribute(request, Constant.SESS_USER);
   if (gus != null && propertyName.equals(PROPERTY_USER)) return gus.getUser();
   else if (gus != null && propertyName.equals(PROPERTY_LOGIN)) return gus.getLogin();
   else if (gus != null && propertyName.equals(PROPERTY_BOX_LIST)) return gus.getBoxList();
   else if (gus != null && propertyName.equals(PROPERTY_SEARCH)) return gus.getSearchKey();
   return null;
 }
Example #3
0
 public static void setUserSession(
     HttpServletRequest request, User loginUser, UserService userService) {
   UserSession gus = new UserSession();
   gus.setUser(loginUser);
   WebUtils.setSessionAttribute(request, Constant.SESS_USER, gus);
 }
Example #4
0
 public static User getSessionUser(HttpSession session) {
   UserSession gus = (UserSession) session.getAttribute(Constant.SESS_USER);
   return gus.getUser();
 }