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


001:        /**
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */package com.sun.portal.rproxy.configservlet;
005:
006:        import java.io.IOException;
007:        import java.io.ObjectInputStream;
008:        import java.io.ObjectOutputStream;
009:        import java.io.OutputStream;
010:        import java.rmi.RemoteException;
011:
012:        import javax.servlet.ServletException;
013:        import javax.servlet.http.HttpServlet;
014:        import javax.servlet.http.HttpServletRequest;
015:        import javax.servlet.http.HttpServletResponse;
016:
017:        import com.iplanet.sso.SSOToken;
018:        import com.iplanet.sso.SSOTokenManager;
019:        import com.sun.portal.rproxy.configservlet.server.CdmHandler;
020:        import com.sun.portal.rproxy.configservlet.server.GatewayServiceHandler;
021:        import com.sun.portal.rproxy.configservlet.server.GlobalAttributesServiceHandler;
022:        import com.sun.portal.rproxy.configservlet.server.UserAttributesServiceHandler;
023:        import com.sun.portal.rproxy.configservlet.server.UserAttributesSetHandler;
024:        import com.sun.portal.rproxy.rewriter.services.idsame.IDSAMEDataServiceSkeleton;
025:
026:        // import java.net.URLDecoder;
027:
028:        /**
029:         * @author sanjib.ghosh@sun.com
030:         * @version 1.0
031:         */
032:
033:        public class RemoteConfigServlet extends HttpServlet {
034:            public void doPost(HttpServletRequest request,
035:                    HttpServletResponse response) throws ServletException,
036:                    IOException {
037:                // System.out.println( "Post" + request );
038:
039:                Request rq = getRequest(request);
040:                if (!validateRequest(rq)) {
041:                    // throw new ServletException("Invalid Gateway session specified
042:                    // !!");
043:                    // return a Response with resp.setNeedRecreateSession(true);
044:                    Response resp = new Response("", "", "");
045:                    resp.setNeedRecreateSession(true);
046:                    sendResponse(response, resp);
047:                    return;
048:                }
049:                Response rsp = handleRequest(rq);
050:                sendResponse(response, rsp);
051:            }
052:
053:            public void doGet(HttpServletRequest request,
054:                    HttpServletResponse response) throws ServletException,
055:                    IOException {
056:                doPost(request, response);
057:            }
058:
059:            private Request getRequest(HttpServletRequest request)
060:                    throws ServletException, IOException {
061:                try {
062:                    ObjectInputStream objectStream = new ObjectInputStream(
063:                            request.getInputStream());
064:                    Request ret = (Request) objectStream.readObject();
065:                    // objectStream.close();
066:                    return ret;
067:                } catch (ClassNotFoundException e) {
068:                    throw new ServletException(e.getMessage());
069:                }
070:            }
071:
072:            private void sendResponse(HttpServletResponse response, Response rsp)
073:                    throws ServletException, IOException {
074:                OutputStream out = response.getOutputStream();
075:                ObjectOutputStream objectStream = new ObjectOutputStream(out);
076:                objectStream.writeObject(rsp);
077:                out.close();
078:            }
079:
080:            private Response handleRequest(Request request) {
081:                ServiceHandler handler = getServiceHandler(request);
082:                try {
083:                    return handler.handleRequest(request);
084:                } catch (RuntimeException e) {
085:                    return new Response(request.getServiceName(), request
086:                            .getRequestType(), e);
087:                } catch (RemoteException e) {
088:                    return new Response(request.getServiceName(), request
089:                            .getRequestType(), e);
090:                }
091:            }
092:
093:            // This class also a factory for Service handler
094:
095:            private static final String GET_GLOBALS = "GET_GLOBALS";
096:
097:            private static final String GET_USERS = "GET_USERS";
098:
099:            // Added by Mridul
100:            private static final String SET_USER_ATTRIBUTES = "SET_USER_ATTRIBUTES";
101:
102:            // EOC : iDSAME migration - Mridul
103:            // Added by Mridul
104:            private static final String CDM_GET_CLIENT_PROPERTY = "CDM_GET_CLIENT_PROPERTY";
105:
106:            // EOC : iDSAME migration - Mridul
107:
108:            private ServiceHandler getServiceHandler(Request request) {
109:
110:                if (GatewayServiceHandler.SERVICE_NAME.equals(request
111:                        .getServiceName())) {
112:                    return new GatewayServiceHandler();
113:                }
114:
115:                if (GET_GLOBALS.equals(request.getRequestType())) {
116:                    return new GlobalAttributesServiceHandler();
117:                }
118:
119:                if (GET_USERS.equals(request.getRequestType())) {
120:                    return new UserAttributesServiceHandler();
121:
122:                }
123:
124:                // iDSAME migration - Mridul
125:                if (SET_USER_ATTRIBUTES.equals(request.getRequestType())) {
126:                    return new UserAttributesSetHandler();
127:                }
128:                // EOC : iDSAME migration - Mridul
129:
130:                // MAP integration - Mridul
131:                if (CDM_GET_CLIENT_PROPERTY.equals(request.getRequestType())) {
132:                    return CdmHandler.getInstance();
133:                }
134:                // EOC : MAP integration - Mridul
135:
136:                // Start of Rewriter Integration
137:                if (IDSAMEDataServiceSkeleton.SERVICE_NAME.equals(request
138:                        .getServiceName())) {
139:                    // System.out.println( "Rewriter Service Called by RemoteConfig
140:                    // Servlet" );
141:                    return new IDSAMEDataServiceSkeleton();
142:                }
143:                // End of Rewriter Integration
144:
145:                return null;
146:            }// getServiceHandler()
147:
148:            private boolean validateRequest(Request req) {
149:
150:                try {
151:                    SSOToken ssoToken = null;
152:                    SSOTokenManager ssoTokenManager = SSOTokenManager
153:                            .getInstance();
154:                    // String strSessionId =
155:                    // URLDecoder.decode(req.getGatewaySessionID());
156:                    String strSessionId = req.getGatewaySessionID();
157:                    ssoToken = ssoTokenManager.createSSOToken(strSessionId);
158:                    if (ssoTokenManager.isValidToken(ssoToken)) {
159:                        // Check whether the principal is srapGateway
160:                        /*
161:                         * if
162:                         * (ssoToken.getPrincipal().getName().toLowerCase().indexOf("srapGateway") !=
163:                         * -1){ return true; }
164:                         */
165:                        return true;
166:                    }
167:                } catch (Exception e) {
168:                }
169:                return false;
170:            }
171:        }// class RemoteConfigServlet
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.