Java Code Examples for javax.servlet.jsp.PageContext#SESSION_SCOPE
The following examples show how to use
javax.servlet.jsp.PageContext#SESSION_SCOPE .
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: TagUtils.java From spring-analysis-note with MIT License | 6 votes |
/** * Determines the scope for a given input {@code String}. * <p>If the {@code String} does not match 'request', 'session', * 'page' or 'application', the method will return {@link PageContext#PAGE_SCOPE}. * @param scope the {@code String} to inspect * @return the scope found, or {@link PageContext#PAGE_SCOPE} if no scope matched * @throws IllegalArgumentException if the supplied {@code scope} is {@code null} */ public static int getScope(String scope) { Assert.notNull(scope, "Scope to search for cannot be null"); if (scope.equals(SCOPE_REQUEST)) { return PageContext.REQUEST_SCOPE; } else if (scope.equals(SCOPE_SESSION)) { return PageContext.SESSION_SCOPE; } else if (scope.equals(SCOPE_APPLICATION)) { return PageContext.APPLICATION_SCOPE; } else { return PageContext.PAGE_SCOPE; } }
Example 2
Source File: TagUtils.java From java-technology-stack with MIT License | 6 votes |
/** * Determines the scope for a given input {@code String}. * <p>If the {@code String} does not match 'request', 'session', * 'page' or 'application', the method will return {@link PageContext#PAGE_SCOPE}. * @param scope the {@code String} to inspect * @return the scope found, or {@link PageContext#PAGE_SCOPE} if no scope matched * @throws IllegalArgumentException if the supplied {@code scope} is {@code null} */ public static int getScope(String scope) { Assert.notNull(scope, "Scope to search for cannot be null"); if (scope.equals(SCOPE_REQUEST)) { return PageContext.REQUEST_SCOPE; } else if (scope.equals(SCOPE_SESSION)) { return PageContext.SESSION_SCOPE; } else if (scope.equals(SCOPE_APPLICATION)) { return PageContext.APPLICATION_SCOPE; } else { return PageContext.PAGE_SCOPE; } }
Example 3
Source File: TagUtils.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Determines the scope for a given input {@code String}. * <p>If the {@code String} does not match 'request', 'session', * 'page' or 'application', the method will return {@link PageContext#PAGE_SCOPE}. * @param scope the {@code String} to inspect * @return the scope found, or {@link PageContext#PAGE_SCOPE} if no scope matched * @throws IllegalArgumentException if the supplied {@code scope} is {@code null} */ public static int getScope(String scope) { Assert.notNull(scope, "Scope to search for cannot be null"); if (scope.equals(SCOPE_REQUEST)) { return PageContext.REQUEST_SCOPE; } else if (scope.equals(SCOPE_SESSION)) { return PageContext.SESSION_SCOPE; } else if (scope.equals(SCOPE_APPLICATION)) { return PageContext.APPLICATION_SCOPE; } else { return PageContext.PAGE_SCOPE; } }
Example 4
Source File: TagUtils.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Determines the scope for a given input {@code String}. * <p>If the {@code String} does not match 'request', 'session', * 'page' or 'application', the method will return {@link PageContext#PAGE_SCOPE}. * @param scope the {@code String} to inspect * @return the scope found, or {@link PageContext#PAGE_SCOPE} if no scope matched * @throws IllegalArgumentException if the supplied {@code scope} is {@code null} */ public static int getScope(String scope) { Assert.notNull(scope, "Scope to search for cannot be null"); if (scope.equals(SCOPE_REQUEST)) { return PageContext.REQUEST_SCOPE; } else if (scope.equals(SCOPE_SESSION)) { return PageContext.SESSION_SCOPE; } else if (scope.equals(SCOPE_APPLICATION)) { return PageContext.APPLICATION_SCOPE; } else { return PageContext.PAGE_SCOPE; } }
Example 5
Source File: TagUtils.java From feilong-taglib with Apache License 2.0 | 6 votes |
/** * Determines the scope for a given input {@code String}. * * <p> * If the {@code String} does not match 'request', 'session', 'page' or 'application', the method will return * {@link PageContext#PAGE_SCOPE}. * </p> * * @param scope * the {@code String} to inspect * @return the scope found, or {@link PageContext#PAGE_SCOPE} if no scope matched * 如果 <code>scope</code> 是null,抛出 {@link NullPointerException}<br> * 如果 <code>scope</code> 是blank,抛出 {@link IllegalArgumentException}<br> */ public static int getScope(String scope){ Validate.notBlank(scope, "scope can't be blank!"); if (scope.equalsIgnoreCase(SCOPE_REQUEST)){ return PageContext.REQUEST_SCOPE; } if (scope.equalsIgnoreCase(SCOPE_SESSION)){ return PageContext.SESSION_SCOPE; } if (scope.equalsIgnoreCase(SCOPE_APPLICATION)){ return PageContext.APPLICATION_SCOPE; } return PageContext.PAGE_SCOPE; }
Example 6
Source File: FakePageContext.java From ontopia with Apache License 2.0 | 6 votes |
@Override public void setAttribute(String name, Object value, int scope) { if (value == null) // JSP spec doesn't allow nulls throw new NullPointerException("Null value not allowed"); switch (scope) { case PageContext.APPLICATION_SCOPE: getServletContext().setAttribute(name, value); break; case PageContext.REQUEST_SCOPE: getRequest().setAttribute(name, value); break; case PageContext.SESSION_SCOPE: getSession().setAttribute(name, value); break; case PageContext.PAGE_SCOPE: attrs.put(name, value); break; default: throw new IllegalArgumentException("Illegal scope argument: " + scope); } }
Example 7
Source File: FakePageContext.java From ontopia with Apache License 2.0 | 6 votes |
@Override public void removeAttribute(String name, int scope) { switch (scope) { case PageContext.APPLICATION_SCOPE: getServletContext().removeAttribute(name); break; case PageContext.REQUEST_SCOPE: getRequest().removeAttribute(name); break; case PageContext.SESSION_SCOPE: getSession().removeAttribute(name); break; case PageContext.PAGE_SCOPE: attrs.remove(name); break; default: throw new IllegalArgumentException("Illegal scope argument: " + scope); } }
Example 8
Source File: VelocityViewTag.java From velocity-tools with Apache License 2.0 | 6 votes |
protected static int toScopeInt(String scope) { if (scope == null) { return PageContext.PAGE_SCOPE; } if (scope.equalsIgnoreCase("request")) { return PageContext.REQUEST_SCOPE; } if (scope.equalsIgnoreCase("session")) { return PageContext.SESSION_SCOPE; } if (scope.equalsIgnoreCase("application")) { return PageContext.APPLICATION_SCOPE; } if (scope.equalsIgnoreCase("page")) { return PageContext.PAGE_SCOPE; } throw new IllegalArgumentException("Unknown scope: "+scope); }
Example 9
Source File: Util.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * Converts the given string description of a scope to the corresponding * PageContext constant. * * The validity of the given scope has already been checked by the * appropriate TLV. * * @param scope String description of scope * * @return PageContext constant corresponding to given scope description * * taken from org.apache.taglibs.standard.tag.common.core.Util */ public static int getScope(String scope){ int ret = PageContext.PAGE_SCOPE; if("request".equalsIgnoreCase(scope)){ ret = PageContext.REQUEST_SCOPE; }else if("session".equalsIgnoreCase(scope)){ ret = PageContext.SESSION_SCOPE; }else if("application".equalsIgnoreCase(scope)){ ret = PageContext.APPLICATION_SCOPE; } return ret; }
Example 10
Source File: Util.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * Converts the given string description of a scope to the corresponding * PageContext constant. * * The validity of the given scope has already been checked by the * appropriate TLV. * * @param scope String description of scope * * @return PageContext constant corresponding to given scope description * * taken from org.apache.taglibs.standard.tag.common.core.Util */ public static int getScope(String scope){ int ret = PageContext.PAGE_SCOPE; if("request".equalsIgnoreCase(scope)){ ret = PageContext.REQUEST_SCOPE; }else if("session".equalsIgnoreCase(scope)){ ret = PageContext.SESSION_SCOPE; }else if("application".equalsIgnoreCase(scope)){ ret = PageContext.APPLICATION_SCOPE; } return ret; }
Example 11
Source File: Util.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * Converts the given string description of a scope to the corresponding * PageContext constant. * * The validity of the given scope has already been checked by the * appropriate TLV. * * @param scope String description of scope * * @return PageContext constant corresponding to given scope description * * taken from org.apache.taglibs.standard.tag.common.core.Util */ public static int getScope(String scope){ int ret = PageContext.PAGE_SCOPE; if("request".equalsIgnoreCase(scope)){ ret = PageContext.REQUEST_SCOPE; }else if("session".equalsIgnoreCase(scope)){ ret = PageContext.SESSION_SCOPE; }else if("application".equalsIgnoreCase(scope)){ ret = PageContext.APPLICATION_SCOPE; } return ret; }
Example 12
Source File: FakePageContext.java From ontopia with Apache License 2.0 | 5 votes |
@Override public Object getAttribute(String name, int scope) { switch (scope) { case PageContext.APPLICATION_SCOPE: return getServletContext().getAttribute(name); case PageContext.REQUEST_SCOPE: return getRequest().getAttribute(name); case PageContext.SESSION_SCOPE: return getSession().getAttribute(name); case PageContext.PAGE_SCOPE: return getAttribute(name); default: throw new IllegalArgumentException("Illegal scope argument: " + scope); } }
Example 13
Source File: TagUtils.java From logging-log4j2 with Apache License 2.0 | 5 votes |
static int getScope(final String scope) { if ("request".equalsIgnoreCase(scope)) { return PageContext.REQUEST_SCOPE; } if ("session".equalsIgnoreCase(scope)) { return PageContext.SESSION_SCOPE; } if ("application".equalsIgnoreCase(scope)) { return PageContext.APPLICATION_SCOPE; } return PageContext.PAGE_SCOPE; }