@Override public void removeAttribute(String name, int scope) { switch(scope) { case PAGE_SCOPE: { environment.getGlobalNamespace().remove(name); break; } case REQUEST_SCOPE: { getRequest().removeAttribute(name); break; } case SESSION_SCOPE: { HttpSession session = getSession(false); if (session != null) { session.removeAttribute(name); } break; } case APPLICATION_SCOPE: { getServletContext().removeAttribute(name); break; } default: { throw new IllegalArgumentException("Invalid scope: " + scope); } } }
@Override public void setAttribute(String name, Object value, int scope) { switch(scope) { case PAGE_SCOPE: { try { environment.setGlobalVariable(name, wrapper.wrap(value)); break; } catch (TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { getRequest().setAttribute(name, value); break; } case SESSION_SCOPE: { getSession(true).setAttribute(name, value); break; } case APPLICATION_SCOPE: { getServletContext().setAttribute(name, value); break; } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }
@Override public Enumeration getAttributeNamesInScope(int scope) { switch(scope) { case PAGE_SCOPE: { try { return new TemplateHashModelExEnumeration(environment.getGlobalNamespace()); } catch (TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { return getRequest().getAttributeNames(); } case SESSION_SCOPE: { HttpSession session = getSession(false); if (session != null) { return session.getAttributeNames(); } return Collections.enumeration(Collections.EMPTY_SET); } case APPLICATION_SCOPE: { return getServletContext().getAttributeNames(); } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }
return getServletContext().getAttribute(name);
public void removeAttribute(String name, int scope) { switch(scope) { case PAGE_SCOPE: { environment.getGlobalNamespace().remove(name); break; } case REQUEST_SCOPE: { getRequest().removeAttribute(name); break; } case SESSION_SCOPE: { HttpSession session = getSession(false); if(session != null) { session.removeAttribute(name); } break; } case APPLICATION_SCOPE: { getServletContext().removeAttribute(name); break; } default: { throw new IllegalArgumentException("Invalid scope: " + scope); } } }
@Override public void removeAttribute(String name, int scope) { switch(scope) { case PAGE_SCOPE: { environment.getGlobalNamespace().remove(name); break; } case REQUEST_SCOPE: { getRequest().removeAttribute(name); break; } case SESSION_SCOPE: { HttpSession session = getSession(false); if (session != null) { session.removeAttribute(name); } break; } case APPLICATION_SCOPE: { getServletContext().removeAttribute(name); break; } default: { throw new IllegalArgumentException("Invalid scope: " + scope); } } }
@Override public void removeAttribute(String name, int scope) { switch(scope) { case PAGE_SCOPE: { environment.getGlobalNamespace().remove(name); break; } case REQUEST_SCOPE: { getRequest().removeAttribute(name); break; } case SESSION_SCOPE: { HttpSession session = getSession(false); if (session != null) { session.removeAttribute(name); } break; } case APPLICATION_SCOPE: { getServletContext().removeAttribute(name); break; } default: { throw new IllegalArgumentException("Invalid scope: " + scope); } } }
@Override public void setAttribute(String name, Object value, int scope) { switch(scope) { case PAGE_SCOPE: { try { environment.setGlobalVariable(name, wrapper.wrap(value)); break; } catch (TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { getRequest().setAttribute(name, value); break; } case SESSION_SCOPE: { getSession(true).setAttribute(name, value); break; } case APPLICATION_SCOPE: { getServletContext().setAttribute(name, value); break; } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }
public void setAttribute(String name, Object value, int scope) { switch(scope) { case PAGE_SCOPE: { try { environment.setGlobalVariable(name, wrapper.wrap(value)); break; } catch(TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { getRequest().setAttribute(name, value); break; } case SESSION_SCOPE: { getSession(true).setAttribute(name, value); break; } case APPLICATION_SCOPE: { getServletContext().setAttribute(name, value); break; } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }
@Override public void setAttribute(String name, Object value, int scope) { switch(scope) { case PAGE_SCOPE: { try { environment.setGlobalVariable(name, wrapper.wrap(value)); break; } catch (TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { getRequest().setAttribute(name, value); break; } case SESSION_SCOPE: { getSession(true).setAttribute(name, value); break; } case APPLICATION_SCOPE: { getServletContext().setAttribute(name, value); break; } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }
public Enumeration getAttributeNamesInScope(int scope) { switch(scope) { case PAGE_SCOPE: { try { return new TemplateHashModelExEnumeration(environment.getGlobalNamespace()); } catch(TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { return getRequest().getAttributeNames(); } case SESSION_SCOPE: { HttpSession session = getSession(false); if(session != null) { return session.getAttributeNames(); } return Collections.enumeration(Collections.EMPTY_SET); } case APPLICATION_SCOPE: { return getServletContext().getAttributeNames(); } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }
@Override public Enumeration getAttributeNamesInScope(int scope) { switch(scope) { case PAGE_SCOPE: { try { return new TemplateHashModelExEnumeration(environment.getGlobalNamespace()); } catch (TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { return getRequest().getAttributeNames(); } case SESSION_SCOPE: { HttpSession session = getSession(false); if (session != null) { return session.getAttributeNames(); } return Collections.enumeration(Collections.EMPTY_SET); } case APPLICATION_SCOPE: { return getServletContext().getAttributeNames(); } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }
@Override public Enumeration getAttributeNamesInScope(int scope) { switch(scope) { case PAGE_SCOPE: { try { return new TemplateHashModelExEnumeration(environment.getGlobalNamespace()); } catch (TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { return getRequest().getAttributeNames(); } case SESSION_SCOPE: { HttpSession session = getSession(false); if (session != null) { return session.getAttributeNames(); } return Collections.enumeration(Collections.EMPTY_SET); } case APPLICATION_SCOPE: { return getServletContext().getAttributeNames(); } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }
return getServletContext().getAttribute(name);
return getServletContext().getAttribute(name);
return getServletContext().getAttribute(name);