Source Code Cross Referenced for WSRPSessionContext.java in  » Portal » Open-Portal » com » sun » portal » wsrp » producer » context » 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 » Open Portal » com.sun.portal.wsrp.producer.context 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         */
013:        package com.sun.portal.wsrp.producer.context;
014:
015:        import com.iplanet.sso.SSOException;
016:        import com.iplanet.sso.SSOToken;
017:        import com.sun.portal.desktop.context.*;
018:        import com.sun.portal.util.SSOUtil;
019:        import com.sun.portal.wsrp.producer.filter.ProducerThreadLocalizer;
020:
021:        import javax.servlet.ServletRequest;
022:        import javax.servlet.http.Cookie;
023:        import javax.servlet.http.HttpServletRequest;
024:
025:        public class WSRPSessionContext implements  SessionContext,
026:                SessionAppContext {
027:            public static final String WSRP_UID_KEY = "desktop.wsrp.uid";
028:            public static final String WSRP_SSOTOKEN = "desktop.wsrp.ssotoken";
029:
030:            private static DesktopAppContext dac = null;
031:            // Use getSSOToken() method to access this
032:            private SSOToken _token = null;
033:
034:            static {
035:                dac = DesktopAppContextThreadLocalizer.get();
036:            }
037:
038:            public String getSessionID(HttpServletRequest req) {
039:                return getUserID();
040:            }
041:
042:            public String getUserID(HttpServletRequest req) {
043:                return (String) req.getAttribute(WSRP_UID_KEY);
044:            }
045:
046:            public String getSessionID() {
047:                ServletRequest sreq = ProducerThreadLocalizer.getRequest();
048:                HttpServletRequest req = (HttpServletRequest) sreq;
049:
050:                return getSessionID(req);
051:            }
052:
053:            public String getUserID() {
054:                ServletRequest sreq = ProducerThreadLocalizer.getRequest();
055:                HttpServletRequest req = (HttpServletRequest) sreq;
056:
057:                return getUserID(req);
058:            }
059:
060:            public boolean validateSession(HttpServletRequest req) {
061:                boolean valid = false;
062:
063:                String wsrpUID = getUserID(req);
064:                if (wsrpUID != null) {
065:                    valid = true;
066:                }
067:
068:                return valid;
069:            }
070:
071:            public void init(HttpServletRequest req, String portalId) {
072:                Object obj = req.getAttribute(WSRPSessionContext.WSRP_SSOTOKEN);
073:                if (obj != null) {
074:                    _token = (SSOToken) obj;
075:                    return;
076:                }
077:                _token = getSSOToken(req);
078:
079:            }
080:
081:            public String getStringProperty(String name) {
082:                try {
083:                    return getSSOToken().getProperty(name);
084:                } catch (SSOException ssoe) {
085:                    throw new ContextError(ssoe, ContextError.SESSION_TYPE);
086:                }
087:
088:            }
089:
090:            public void setStringProperty(String name, String val) {
091:
092:                try {
093:                    getSSOToken().setProperty(name, val);
094:                } catch (SSOException ssoe) {
095:                    throw new ContextError(ssoe, ContextError.SESSION_TYPE);
096:                }
097:
098:            }
099:
100:            private synchronized SSOToken getSSOToken() {
101:                if (_token == null) {
102:                    throw new ContextError(
103:                            "WSRPSessionContext.getSSOToken(): not initialized");
104:                }
105:
106:                return _token;
107:            }
108:
109:            private synchronized SSOToken getSSOToken(HttpServletRequest req) {
110:                SSOToken token;
111:                String uid = getUserID(req);
112:                try {
113:                    token = SSOUtil.createSSOToken(uid, uid);
114:
115:                } catch (SSOException se) {
116:                    // This means that SSOToken is invalid
117:                    throw new ContextError(se, ContextError.SESSION_TYPE);
118:                }
119:
120:                return token;
121:            }
122:
123:            public void addSessionListener(SessionListener sl) {
124:                // not implemented
125:            }
126:
127:            public void addUserListener(UserListener sl) {
128:                // not implemented
129:            }
130:
131:            public String encodeURL(String url) {
132:                // not implemented do we need this?
133:                return url;
134:            }
135:
136:            public String getAuthenticationType() {
137:                return "desktop.wsrp";
138:            }
139:
140:            /* Properties that are stored as Cookie on client browser.
141:             * AuthlessAnonymous user state is managed via such cookie.
142:             * Authenticated users use AM/DSAME session to manage user state, returns null in such case.
143:             */
144:            public Cookie getClientProperties() {
145:                return null;
146:            }
147:
148:            public static String getStaticPortalId() {
149:                return dac.getPortalId();
150:            }
151:
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.