content: package com.taobao.arthas.core.shell.term.impl.http.session;
  
  import java.util.Collections;
  import java.util.Enumeration;
  import java.util.Map;
  import java.util.concurrent.ConcurrentHashMap;
  
  import com.taobao.arthas.core.util.StringUtils;
  
  /**
   * 
   * @author hengyunabc 2021-03-03
   *
   */
  public class SimpleHttpSession implements HttpSession {
      private Map<String, Object> attributes = new ConcurrentHashMap<String, Object>();
  
      private String id;
  
      public SimpleHttpSession() {
          id = StringUtils.randomString(32);
      }
  
      @Override
      public long getCreationTime() {
          return 0;
      }
  
      @Override
      public String getId() {
          return id;
      }
  
      @Override
      public long getLastAccessedTime() {
          return 0;
      }
  
      @Override
      public void setMaxInactiveInterval(int interval) {
  
      }
  
      @Override
      public int getMaxInactiveInterval() {
          return 0;
      }
  
      @Override
      public Object getAttribute(String name) {
          return attributes.get(name);
      }
  
      @Override
      public Enumeration<String> getAttributeNames() {
          return Collections.enumeration(this.attributes.keySet());
      }
  
      @Override
      public void setAttribute(String name, Object value) {
          attributes.put(name, value);
      }
  
      @Override
      public void removeAttribute(String name) {
          attributes.remove(name);
      }
  
      @Override
      public void invalidate() {
  
      }
  
      @Override
      public boolean isNew() {
          return false;
      }
  
  }
  