1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.servlet;
16  
17  import java.util.Collections;
18  import java.util.HashSet;
19  import java.util.Set;
20  
21  import javax.servlet.http.HttpServletRequest;
22  import javax.servlet.http.HttpServletRequestWrapper;
23  
24  /**
25   * <a href="TrackedServletRequest.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class TrackedServletRequest extends HttpServletRequestWrapper {
30  
31      public TrackedServletRequest(HttpServletRequest request) {
32          super(request);
33      }
34  
35      public Set<String> getSetAttributes() {
36          if (_setAttributes == null) {
37              return Collections.EMPTY_SET;
38          }
39          else {
40              return _setAttributes;
41          }
42      }
43  
44      public void setAttribute(String name, Object obj) {
45          if (_setAttributes == null) {
46              _setAttributes = new HashSet<String>();
47          }
48  
49          _setAttributes.add(name);
50  
51          super.setAttribute(name, obj);
52      }
53  
54      private Set<String> _setAttributes;
55  
56  }