List of usage examples for javax.servlet.http HttpSession setAttribute
public void setAttribute(String name, Object value);
From source file:com.thruzero.common.jsf.utils.FlashUtils.java
private static FlashHack getFlashHack(boolean createIfNonExistant) { FlashHack result = null;/* www .jav a2s .c o m*/ HttpSession session = FacesUtils.getSession(createIfNonExistant); if (session != null) { result = (FlashHack) session.getAttribute(FLASH_HACK_SESSION_KEY); if (result == null && createIfNonExistant) { result = new FlashHack(); session.setAttribute(FLASH_HACK_SESSION_KEY, result); } } return result; }
From source file:com.bluexml.side.Framework.alfresco.shareLanguagePicker.CustomDispatcherServlet.java
public static void setLanguageFromLayoutParam(HttpServletRequest req) { String urlLang = req.getParameter("shareLang"); HttpSession currentSession = req.getSession(); String sessionLang = (String) currentSession.getAttribute("shareLang"); //1st option: Select the url param shareLang if (urlLang != null) { I18NUtil.setLocale(I18NUtil.parseLocale(urlLang)); currentSession.setAttribute("shareLang", urlLang); } else if (sessionLang != null) { I18NUtil.setLocale(I18NUtil.parseLocale(sessionLang)); } else {/* ww w .jav a 2 s . c o m*/ // set language locale from browser header String acceptLang = req.getHeader("Accept-Language"); if (acceptLang != null && acceptLang.length() != 0) { StringTokenizer t = new StringTokenizer(acceptLang, ",; "); // get language and convert to java locale format String language = t.nextToken().replace('-', '_'); I18NUtil.setLocale(I18NUtil.parseLocale(language)); } } }
From source file:com.manydesigns.elements.messages.SessionMessages.java
protected static BlockingQueue<String> getQueue(String queueName) { HttpServletRequest req = ElementsThreadLocals.getHttpServletRequest(); if (req == null) { logger.debug("No request available. Returning dummy queue."); return new LinkedBlockingQueue<String>(); }/*w w w.j a v a 2 s .c o m*/ HttpSession session = req.getSession(); BlockingQueue<String> infoQueue; synchronized (session) { infoQueue = (BlockingQueue) session.getAttribute(queueName); if (infoQueue == null) { // install a new queue infoQueue = new LinkedBlockingQueue<String>(); session.setAttribute(queueName, infoQueue); } } return infoQueue; }
From source file:com.amalto.webapp.core.bean.Configuration.java
private static void storeInSession(Configuration configuration) { HttpSession session = SessionContextHolder.currentSession(); if (session != null) { if (LOG.isDebugEnabled()) { LOG.debug("Registering configuration into session " + session.getId()); //$NON-NLS-1$ }//from www . ja va 2 s . co m session.setAttribute(MDM_CONFIGURATION_ATTRIBUTE, configuration); } }
From source file:tools.EpsServletUtilities.java
protected static void registerChartForDeletion(File tempFile, HttpSession session) { // Add chart to deletion list in session if (session != null) { EpsDeleter chartDeleter = (EpsDeleter) session.getAttribute("EpsChart_Deleter"); if (chartDeleter == null) { chartDeleter = new EpsDeleter(); session.setAttribute("EpsChart_Deleter", chartDeleter); }//from w ww . ja v a 2s.co m chartDeleter.addChart(tempFile.getName()); System.out.println("add a chart to delete: " + tempFile.getName()); } else { System.out.println("Session is null - chart will not be deleted"); } }
From source file:com.impetus.kundera.graphbrowser.IMDBUtils.java
public static IMDBService getIMDBService() { HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true); IMDBService imdbService = (IMDBService) session.getAttribute("imdb"); if (imdbService == null) { BeanFactory beanfactory = new ClassPathXmlApplicationContext("appContext.xml"); imdbService = (IMDBService) beanfactory.getBean("imdb"); // imdbService.init(); session.setAttribute("imdb", imdbService); }//from w w w .ja v a2 s . c o m return imdbService; }
From source file:org.sloth.util.ControllerUtils.java
/** * Authorizes the {@code HttpSession} with the specified {@code User}. * /*from w w w . j a v a 2 s .c o m*/ * @param s * the {@code HttpSession} * @param u * the {@code User} */ public static void auth(HttpSession s, User u) { if (u == null) { throw new NullPointerException("User must not be null."); } logger.info("Authorizing Session {} by User {}", s.getId(), u.getId()); s.setAttribute(SESSION_ATTRIBUTE, u); }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
public static void setUesrSeq(int seq) { HttpSession sStore = RWT.getRequest().getSession(); sStore.setAttribute(NAME.USER_SEQ.name(), seq); }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
/** * UserManager Object list ./*from w w w . ja v a2 s . co m*/ * * @param managerDTO */ public static void initManagerDBList() { HttpSession sStore = RWT.getRequest().getSession(); sStore.setAttribute(NAME.ALL_MANAGER_DB_LIST.name(), new ArrayList<ManagerListDTO>()); }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
/** * UserManager Object list .//from ww w.jav a 2 s. c o m * * @param managerDTO */ public static void setManagerDBList(List<ManagerListDTO> listManagerDTO) { HttpSession sStore = RWT.getRequest().getSession(); sStore.setAttribute(NAME.ALL_MANAGER_DB_LIST.name(), listManagerDTO); }