/** * {@inheritDoc} */ @Override public void invalidate() throws IllegalStateException { checkInvalidatedSession(); isInvalidated = true; }
/** * {@inheritDoc} */ @Override public boolean isNew() { checkInvalidatedSession(); return creationTime == lastAccessedTime; }
/** * {@inheritDoc} */ @Override public long getCreationTime() throws IllegalStateException { checkInvalidatedSession(); return creationTime; }
/** * {@inheritDoc} */ @Override public long getLastAccessedTime() throws IllegalStateException { checkInvalidatedSession(); return lastAccessedTime; }
/** * {@inheritDoc} */ @Override public void removeAttribute(final String name) throws IllegalStateException { checkInvalidatedSession(); attributes.remove(name); }
/** * {@inheritDoc} */ @Override public Object getAttribute(final String name) throws IllegalStateException { checkInvalidatedSession(); if (attributes.containsKey(name)) { return attributes.get(name); } return null; }
/** * {@inheritDoc} */ @Override public void setAttribute(final String name, final Object value) throws IllegalStateException { checkInvalidatedSession(); if (value == null) { attributes.remove(name); } else { attributes.put(name, value); } }
/** * {@inheritDoc} */ @Override public Enumeration getAttributeNames() throws IllegalStateException { checkInvalidatedSession(); final Iterator iterator = attributes.keySet().iterator(); return new Enumeration() { @Override public boolean hasMoreElements() { return iterator.hasNext(); } @Override public Object nextElement() { return iterator.next(); } }; }