Source Code Cross Referenced for PortletParameterRequestWrapper.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » container » servlet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal.container.servlet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2004 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal.container.servlet;
007:
008:        import java.util.Collections;
009:        import java.util.Enumeration;
010:        import java.util.HashMap;
011:        import java.util.Iterator;
012:        import java.util.Map;
013:
014:        import javax.servlet.http.HttpServletRequest;
015:        import javax.servlet.http.HttpServletRequestWrapper;
016:
017:        import org.jasig.portal.container.services.information.PortletStateManager;
018:
019:        /**
020:         * A {@link javax.servlet.http.HttpServletRequestWrapper} that only allows
021:         * non-portal paramters to be seen. The determination is done by hidding
022:         * parameters that begin with {@link PortletStateManager#UP_PARAM_PREFIX}.
023:         * All other paramters are let through.
024:         * 
025:         * @author Eric Dalquist <a href="mailto:edalquist@unicon.net">edalquist@unicon.net</a>
026:         * @version $Revision: 36796 $
027:         */
028:        public class PortletParameterRequestWrapper extends
029:                AttributeRequestWrapper {
030:            private static final String ESCAPE_PREFIX = PortletStateManager.UP_PARAM_PREFIX
031:                    + PortletStateManager.UP_PARAM_PREFIX;
032:
033:            /**
034:             * Creates a new wrapper and wraps the specified request.
035:             * 
036:             * @param request The requst to wrap.
037:             * @see HttpServletRequestWrapper#HttpServletRequestWrapper(javax.servlet.http.HttpServletRequest)
038:             */
039:            public PortletParameterRequestWrapper(
040:                    final HttpServletRequest request) {
041:                super (request);
042:            }
043:
044:            /* 
045:             * @see javax.servlet.ServletRequest#getParameter(java.lang.String)
046:             */
047:            public String getParameter(final String name) {
048:                if (name != null
049:                        && name.startsWith(PortletStateManager.UP_PARAM_PREFIX)) {
050:                    return null;
051:                } else {
052:                    return super .getParameter(name);
053:                }
054:            }
055:
056:            /* 
057:             * @see javax.servlet.ServletRequest#getParameterMap()
058:             */
059:            public Map getParameterMap() {
060:                return this .getPortletParameterMap();
061:            }
062:
063:            /* 
064:             * @see javax.servlet.ServletRequest#getParameterNames()
065:             */
066:            public Enumeration getParameterNames() {
067:                return Collections.enumeration(this .getParameterMap().keySet());
068:            }
069:
070:            /* 
071:             * @see javax.servlet.ServletRequest#getParameterValues(java.lang.String)
072:             */
073:            public String[] getParameterValues(final String name) {
074:                if (name != null
075:                        && name.startsWith(PortletStateManager.UP_PARAM_PREFIX)) {
076:                    return null;
077:                } else {
078:                    return super .getParameterValues(name);
079:                }
080:            }
081:
082:            /**
083:             * Does the work of creating a {@link Map} of non-portal parameters
084:             * for the public methods of this class to use.
085:             * 
086:             * @return A {@link Map} of non-portal parameters.
087:             */
088:            private Map getPortletParameterMap() {
089:                final Map allParams = super .getParameterMap();
090:                final Map portletParams = new HashMap(allParams.size() * 2);
091:
092:                for (final Iterator pNameItr = allParams.keySet().iterator(); pNameItr
093:                        .hasNext();) {
094:                    final String pName = (String) pNameItr.next();
095:
096:                    if (pName == null
097:                            || !pName
098:                                    .startsWith(PortletStateManager.UP_PARAM_PREFIX)) {
099:                        final Object pVal = allParams.get(pName);
100:
101:                        portletParams.put(pName, pVal);
102:                    }
103:                    //Deals with parameters that are ok and start with the prefix
104:                    else if (pName.startsWith(ESCAPE_PREFIX)) {
105:                        final Object pVal = allParams.get(pName);
106:
107:                        portletParams.put(pName
108:                                .substring(PortletStateManager.UP_PARAM_PREFIX
109:                                        .length()), pVal);
110:                    }
111:                }
112:
113:                return Collections.unmodifiableMap(portletParams);
114:            }
115:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.