public void setAttribute(String name, Object value) {
   checkActive();
   Assert.notNull(name, "Attribute name must not be null");
   if (value != null) {
     this.attributes.put(name, value);
   } else {
     this.attributes.remove(name);
   }
 }
 public HttpSession getSession(boolean create) {
   checkActive();
   // Reset session if invalidated.
   if (this.session instanceof MockHttpSession && ((MockHttpSession) this.session).isInvalid()) {
     this.session = null;
   }
   // Create new session if necessary.
   if (this.session == null && create) {
     this.session = new MockHttpSession(this.servletContext);
   }
   return this.session;
 }
 public void removeAttribute(String name) {
   checkActive();
   Assert.notNull(name, "Attribute name must not be null");
   this.attributes.remove(name);
 }
 public Enumeration<String> getAttributeNames() {
   checkActive();
   return Collections.enumeration(this.attributes.keySet());
 }
 public Object getAttribute(String name) {
   checkActive();
   return this.attributes.get(name);
 }