List of usage examples for javax.servlet.jsp PageContext SESSION_SCOPE
int SESSION_SCOPE
To view the source code for javax.servlet.jsp PageContext SESSION_SCOPE.
Click Source Link
From source file:com.tonbeller.wcf.expr.ExprUtils.java
public static ExprContext getExprContextAdapter(final PageContext pageContext) { return new ExprContext() { public Object findBean(String name) { return pageContext.findAttribute(name); }//from www.ja v a 2s. com public void setBean(String name, Object bean) { if (bean == null) pageContext.removeAttribute(name); else pageContext.setAttribute(name, bean, PageContext.SESSION_SCOPE); } }; }
From source file:com.eurelis.opencms.admin.xmltransformation.ui.CmsXmlMockProcessDialog.java
public static CmsXmlMockProcessDialog newInstance(PageContext context, HttpServletRequest req, HttpServletResponse res) {/* w w w . j a va 2 s. co m*/ String currentParamSessionSortCol = (String) context.getAttribute("sort_column", PageContext.SESSION_SCOPE); CmsListOrderEnum currentSessionSortOrder = (CmsListOrderEnum) context.getAttribute("sort_order", PageContext.SESSION_SCOPE); String requestParamSessionSortCol = req.getParameter(PARAM_SORT_COL); String action = req.getParameter(PARAM_ACTION); CmsListOrderEnum listOrder; boolean refreshList = false; if (currentParamSessionSortCol == null || requestParamSessionSortCol == null) { listOrder = CmsListOrderEnum.ORDER_ASCENDING; requestParamSessionSortCol = LIST_COLUMN_PATH; } else { if (action.equals(LIST_SORT)) { if (requestParamSessionSortCol.equals(currentParamSessionSortCol)) { refreshList = true; if (currentSessionSortOrder.equals(CmsListOrderEnum.ORDER_ASCENDING)) { listOrder = CmsListOrderEnum.ORDER_DESCENDING; } else { listOrder = CmsListOrderEnum.ORDER_ASCENDING; } } else { listOrder = CmsListOrderEnum.ORDER_ASCENDING; } } else { listOrder = currentSessionSortOrder; } } context.setAttribute("sort_order", listOrder, PageContext.SESSION_SCOPE); context.setAttribute("sort_column", requestParamSessionSortCol, PageContext.SESSION_SCOPE); CmsXmlMockProcessDialog returnObject = new CmsXmlMockProcessDialog( new CmsJspActionElement(context, req, res), LIST_ID, Messages.get().container(Messages.GUI_MOCK_PROCESS_LIST_NAME_0), requestParamSessionSortCol, listOrder, null); if (refreshList) { returnObject.refreshList(); } return returnObject; }
From source file:net.ontopia.topicmaps.nav2.utils.FrameworkUtils.java
/** * INTERNAL: Gets user object out of session scope. *///from w w w . j a v a2 s. c om public static UserIF getUser(PageContext pageContext, boolean create) { try { Object obj = pageContext.getAttribute(NavigatorApplicationIF.USER_KEY, PageContext.SESSION_SCOPE); if (obj != null && obj instanceof UserIF) return (UserIF) obj; else // if no user object exists just create a new one return (create ? createUserSession(pageContext) : null); } catch (java.lang.IllegalStateException e) { // sessions not allowed in page, so get the user from the request scope instead Object obj = pageContext.getAttribute(NavigatorApplicationIF.USER_KEY, PageContext.REQUEST_SCOPE); if (obj != null && obj instanceof UserIF) return (UserIF) obj; else // if no user object exists just create a new one return (create ? createUserSession(pageContext, PageContext.REQUEST_SCOPE) : null); } }
From source file:info.magnolia.cms.taglibs.Out.java
/** * Setter for <code>scope</code>. * @param scope The scope to set.// w ww . j a v a 2 s. c o m */ public void setScope(String scope) { if ("request".equalsIgnoreCase(scope)) { //$NON-NLS-1$ this.scope = PageContext.REQUEST_SCOPE; } else if ("session".equalsIgnoreCase(scope)) { //$NON-NLS-1$ this.scope = PageContext.SESSION_SCOPE; } else if ("application".equalsIgnoreCase(scope)) { //$NON-NLS-1$ this.scope = PageContext.APPLICATION_SCOPE; } else { // default this.scope = PageContext.PAGE_SCOPE; } }
From source file:net.ontopia.topicmaps.nav2.utils.FrameworkUtils.java
/** * INTERNAL: Create new user object in session scope. *//*from w ww .j a v a 2 s . c o m*/ public static UserIF createUserSession(PageContext pageContext) { return createUserSession(pageContext, PageContext.SESSION_SCOPE); }
From source file:net.mlw.vlh.web.tag.ValueListSpaceTag.java
/** * @see javax.servlet.jsp.tagext.Tag#doStartTag() *///from w w w. ja v a 2s. c o m public int doStartTag() throws JspException { parentRootTag = (ValueListSpaceTag) findAncestorWithClass(this, ValueListSpaceTag.class); Object bean; if ("session".equals(valueListScope)) { bean = pageContext.getAttribute(valueListName, PageContext.SESSION_SCOPE); } else if ("application".equals(valueListScope)) { bean = pageContext.getAttribute(valueListName, PageContext.APPLICATION_SCOPE); } else { bean = pageContext.getAttribute(valueListName, PageContext.REQUEST_SCOPE); } if (bean != null) { if (bean instanceof ValueList) { setValueList((ValueList) bean); } else if (bean instanceof List) { setValueList(new DefaultListBackedValueList((List) bean)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("List '" + valueListName + "' was wrapped with DefaultListBackedValueList."); } } else { String msg = "ValueList '" + valueListName + "' of of unknown type " + bean.getClass().getName() + "!"; LOGGER.warn(msg); } } else { LOGGER.error("ValueList '" + valueListName + "' was not found in the scope '" + (valueListScope == null ? "request" : valueListScope) + "'!"); } if (bean != null) { pageContext.setAttribute(valueListName, bean); } tableInfo.setName(valueListName); tableInfo.setConfig(getConfig()); tableInfo.setPageContext(pageContext); // TODO Do not swallow this!!!!! pageContext.setAttribute(ImagesHomeDisplayHelper.IMAGES_HOME_ATTRIBUTE_KEY, ((HtmlDisplayProvider) tableInfo.getConfig().getDisplayProvider("html")) .getImageHome((HttpServletRequest) pageContext.getRequest())); /** * @author Luciano Cunha */ excludeParameters(); return super.doStartTag(); }
From source file:net.sourceforge.fenixedu.presentationTier.TagLib.content.ContentLinkTag.java
public static int getPageScope(final String scope) { if (scope == null) { return -1; } else if (scope.equalsIgnoreCase("page")) { return PageContext.PAGE_SCOPE; } else if (scope.equalsIgnoreCase("request")) { return PageContext.REQUEST_SCOPE; } else if (scope.equalsIgnoreCase("session")) { return PageContext.SESSION_SCOPE; } else {/*from www .j a v a2s . c om*/ return -1; } }
From source file:gov.nih.nci.cabig.caaers.web.tags.csm.CSMAccessControlTag.java
/** * Populates the variable in the specified scope. * @param varValue/* w ww . ja va2 s. co m*/ */ private void setVariable(boolean varValue) { if (var == null) return; int intScope = StringUtils.equals(scope, "request") ? PageContext.REQUEST_SCOPE : StringUtils.equals(scope, "session") ? PageContext.SESSION_SCOPE : StringUtils.equals(scope, "application") ? PageContext.APPLICATION_SCOPE : PageContext.PAGE_SCOPE; pageContext.setAttribute(getVar(), varValue, intScope); }
From source file:com.googlecode.jtiger.modules.ecside.util.ExtremeUtils.java
/** * Get the bean out of the proper scope. *//*from w w w.jav a 2 s . co m*/ public static Object retrieveFromScope(PageContext pageContext, String name, String scope) { if (StringUtils.isBlank(scope)) { return pageContext.findAttribute(name); } int scopeType = PageContext.REQUEST_SCOPE; if (scope.equalsIgnoreCase("page")) { scopeType = PageContext.PAGE_SCOPE; } else if (scope.equalsIgnoreCase("application")) { scopeType = PageContext.APPLICATION_SCOPE; } else if (scope.equalsIgnoreCase("session")) { scopeType = PageContext.SESSION_SCOPE; } return pageContext.getAttribute(name, scopeType); }
From source file:net.ontopia.topicmaps.nav2.utils.FrameworkUtils.java
/** * INTERNAL: Reset MVS settings in user object in session scope. *///from ww w .ja v a 2s. c o m public static void resetMVSsettingsInUserSession(PageContext pageContext) { NavigatorConfigurationIF navConf = NavigatorUtils.getNavigatorApplication(pageContext).getConfiguration(); //! UserIF user = (UserIF) pageContext.getAttribute(NavigatorApplicationIF.USER_KEY, //! PageContext.SESSION_SCOPE); UserIF user = getUser(pageContext, false); if (user == null) return; // ignore if no user // reset MVS settings user = setDefaultMVS(navConf, user); // set user object to session scope (TODO: support other contexts?) pageContext.setAttribute(NavigatorApplicationIF.USER_KEY, user, PageContext.SESSION_SCOPE); log.info("MVS settings in user session has been reset."); }