public Enumeration getAttributeNamesInScope()

in velocity-tools-view-jsp/src/main/java/org/apache/velocity/tools/view/jsp/jspimpl/VelocityPageContext.java [357:405]


    public Enumeration<String> getAttributeNamesInScope(int scope) {
        switch (scope)
        {
        case PAGE_SCOPE:
        	return new Enumeration<String>()
			{

        		private int index = 0;

        		private Object[] keys = velocityContext.getKeys();

				public boolean hasMoreElements()
                {
	                return index < keys.length;
                }

				public String nextElement()
                {
	                String retValue = (String) keys[index];
	                index++;
	                return retValue;
                }
			};
        case REQUEST_SCOPE:
        	return request.getAttributeNames();
        case SESSION_SCOPE:
    		HttpSession session = request.getSession(false);
    		if (session != null) {
    			return session.getAttributeNames();
    		}
    		return new Enumeration<String>()
			{

				public boolean hasMoreElements()
                {
	                return false;
                }

				public String nextElement()
                {
	                throw new NoSuchElementException("This is an empty enumeration");
                }
			};
        case APPLICATION_SCOPE:
        	return viewContext.getServletContext().getAttributeNames();
        default:
        	throw new IllegalArgumentException("Invalid scope constant value: " + scope);
        }
    }