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


001:        /**
002:         * Copyright 2003 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:         */package com.sun.portal.wsrp.consumer.markup.impl;
013:
014:        import com.sun.portal.container.ContainerRequest;
015:        import com.sun.portal.container.ContainerException;
016:        import com.sun.portal.container.ContentException;
017:
018:        import com.sun.portal.wsrp.common.stubs.SessionContext;
019:        import com.sun.portal.wsrp.common.stubs.WSRP_v1_Markup_PortType;
020:
021:        import com.sun.portal.wsrp.consumer.markup.ProducerSessionManager;
022:        import com.sun.portal.wsrp.consumer.markup.MarkupConfig;
023:        import com.sun.portal.wsrp.consumer.common.RemoteServiceStubManager;
024:        import com.sun.portal.wsrp.consumer.common.WSRPConsumerException;
025:        import com.sun.portal.log.common.PortalLogger;
026:
027:        import java.net.URL;
028:        import java.rmi.RemoteException;
029:        import java.util.logging.Level;
030:        import java.util.logging.Logger;
031:
032:        /**
033:         * This is the implementation of ProducerSessionManager for anonymous/authless
034:         * user that has methods to manage the session with a WSRP Producer.
035:         * When ever Anonymous is not allowed to have session, means 
036:         * anonymous desktop shouldn't be configured with a portlet from 
037:         * producer that requires initCookie. This implementation is used for 
038:         * anonymous user when that is the case.Having such portlet means
039:         * the markup stub needs to be saved for the session and for 
040:         * anonymous user, there is no place to store it.
041:         * Hence all session information is stored in client properties
042:         * for anonymous user 
043:         * 
044:         */
045:
046:        public class ProducerSessionManagerNoInitCookie implements 
047:                ProducerSessionManager {
048:
049:            public final static String WSRP_SESSION_ID = "wsrp_session_id_";
050:
051:            private static Logger logger = PortalLogger
052:                    .getLogger(ProducerSessionManagerNoInitCookie.class);
053:
054:            /**
055:             * Check javadoc of interface.
056:             * 
057:             * @param markupConfig
058:             * @param request
059:             * @param sessionContext
060:             * @exception com.sun.portal.container.ContainerException
061:             * @exception com.sun.portal.container.ContentException
062:             */
063:            public void processSessionContext(MarkupConfig markupConfig,
064:                    ContainerRequest request, SessionContext sessionContext)
065:                    throws ContainerException, ContentException {
066:
067:                String sessionId = null;
068:
069:                if (sessionContext != null) {
070:
071:                    sessionId = sessionContext.getSessionID();
072:
073:                    MarkupUtil.getProviderContext(request).setClientProperty(
074:                            WSRP_SESSION_ID + request.getEntityID(), sessionId);
075:
076:                }
077:
078:                //
079:                // debug section
080:                //
081:                if (logger.isLoggable(Level.FINEST)) {
082:                    String[] param = { "session id ", sessionId };
083:                    logger.log(Level.FINEST, "PSWS_CSPWCMI0007", param);
084:                }
085:            }
086:
087:            /**
088:             * Check javadoc of interface.
089:             * 
090:             * @param markupConfig
091:             * @param request
092:             * @exception com.sun.portal.container.ContainerException
093:             * @exception com.sun.portal.container.ContentException
094:             */
095:            public String getProducerSessionId(MarkupConfig markupConfig,
096:                    ContainerRequest request) throws ContainerException,
097:                    ContentException {
098:
099:                return (String) MarkupUtil.getProviderContext(request)
100:                        .getClientProperty(
101:                                WSRP_SESSION_ID + request.getEntityID());
102:
103:            }
104:
105:            /**
106:             * Check javadoc of interface.
107:             * 
108:             * @param markupConfig
109:             * @param request
110:             * @exception com.sun.portal.container.ContainerException
111:             * @exception com.sun.portal.container.ContentException
112:             */
113:            public void resetSessionId(String invalidSessionId,
114:                    MarkupConfig markupConfig, ContainerRequest request)
115:                    throws ContainerException, ContentException {
116:
117:                //
118:                // debug section
119:                //
120:
121:                if (logger.isLoggable(Level.FINEST)) {
122:                    String[] param = { "invalid session", invalidSessionId };
123:                    logger.log(Level.FINEST, "PSWS_CSPWCMI0007", param);
124:                }
125:
126:                MarkupUtil.getProviderContext(request).setClientProperty(
127:                        WSRP_SESSION_ID + request.getEntityID(), (String) null);
128:
129:            }
130:
131:            /**
132:             * This gets a stub that can be shared by all users since 
133:             * anonymous shouldn't be configured with a portlet
134:             * that requires a stub that can't be shared.
135:             * 
136:             * @param markupConfig
137:             * @param request
138:             */
139:            public WSRP_v1_Markup_PortType getMarkupPortType(
140:                    MarkupConfig markupConfig, ContainerRequest request)
141:                    throws ContainerException, ContentException {
142:
143:                WSRP_v1_Markup_PortType portType = null;
144:
145:                URL producerURL = markupConfig.getProducerEntity().getURL();
146:
147:                RemoteServiceStubManager rssm = markupConfig
148:                        .getRemoteServiceStubManager();
149:
150:                try {
151:
152:                    //
153:                    // retrieve the markup port type endpoint from
154:                    // the producer entity
155:                    //
156:
157:                    String endpoint = markupConfig.getProducerEntity()
158:                            .getMarkupEndpoint();
159:
160:                    portType = rssm.getMarkupPortType(endpoint,
161:                            RemoteServiceStubManager.FOR_ALL);
162:                } catch (WSRPConsumerException ex) {
163:                    throw new ContainerException(ex.getMessage(), ex);
164:                }
165:
166:                if (logger.isLoggable(Level.FINEST))
167:                    logger.log(Level.FINEST, "PSWS_CSPWCMI0017");
168:
169:                return portType;
170:
171:            }
172:
173:            /**
174:             *
175:             * this should never be called for anonymous
176:             * since it is called only when InvalidCookieFault is
177:             * thrown for a markup stub, which won't be the case for 
178:             * anonymous as it shouldn't be configured with a portlet
179:             * that needs initCookie at the first place.
180:             */
181:            public void resetMarkupPortType(
182:                    WSRP_v1_Markup_PortType invalidPortType,
183:                    MarkupConfig markupConfig, ContainerRequest request)
184:                    throws ContainerException, ContentException {
185:
186:                throw new ContainerException(
187:                        "Anonymnous user can't be configured "
188:                                + " with a portlet requiring initCookie.");
189:            }
190:
191:            /**
192:             * Return null, since there is no cookie setting for 
193:             * anonymous.
194:             *
195:             * @param markupConfig
196:             * @param request
197:             */
198:            public String getCookieHandleKey(MarkupConfig markupConfig,
199:                    ContainerRequest request) throws ContainerException {
200:
201:                return null;
202:
203:            }
204:
205:        }
ww_w__.__j___a___v__a_2s_.__c_o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.