View Javadoc
1   /**
2    * Waffle (https://github.com/dblock/waffle)
3    *
4    * Copyright (c) 2010 - 2015 Application Security, Inc.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of the Eclipse Public License v1.0
8    * which accompanies this distribution, and is available at
9    * http://www.eclipse.org/legal/epl-v10.html
10   *
11   * Contributors:
12   *     Application Security, Inc.
13   */
14  package waffle.apache.catalina;
15  
16  import java.util.Map;
17  
18  import javax.servlet.http.HttpSession;
19  
20  /**
21   * Simple HTTP Session.
22   * 
23   * @author dblock[at]dblock[dot]org
24   */
25  public abstract class SimpleHttpSession implements HttpSession {
26  
27      private Map<String, Object> attributes;
28  
29      @Override
30      public Object getAttribute(final String attributeName) {
31          return this.attributes.get(attributeName);
32      }
33  
34      @Override
35      public String getId() {
36          return "WaffleId";
37      }
38  
39      @Override
40      public void removeAttribute(final String attributeName) {
41          this.attributes.remove(attributeName);
42      }
43  
44      @Override
45      public void setAttribute(final String attributeName, final Object attributeValue) {
46          this.attributes.put(attributeName, attributeValue);
47      }
48  
49      public void setAttributes(final Map<String, Object> value) {
50          this.attributes = value;
51      }
52  
53  }