001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.servlet;
016    
017    import java.util.Collections;
018    import java.util.HashSet;
019    import java.util.Set;
020    
021    import javax.servlet.http.HttpServletRequest;
022    import javax.servlet.http.HttpServletRequestWrapper;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     */
027    public class TrackedServletRequest extends HttpServletRequestWrapper {
028    
029            public TrackedServletRequest(HttpServletRequest request) {
030                    super(request);
031            }
032    
033            public Set<String> getSetAttributes() {
034                    if (_setAttributes == null) {
035                            return Collections.EMPTY_SET;
036                    }
037                    else {
038                            return _setAttributes;
039                    }
040            }
041    
042            public void setAttribute(String name, Object obj) {
043                    if (_setAttributes == null) {
044                            _setAttributes = new HashSet<String>();
045                    }
046    
047                    _setAttributes.add(name);
048    
049                    super.setAttribute(name, obj);
050            }
051    
052            private Set<String> _setAttributes;
053    
054    }