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


001:        /**
002:         * $Id: WSDLServlet.java,v 1.7 2006/05/12 13:26:55 mg155852 Exp $
003:         * Copyright 2003 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.wsrp.producer.wsdl;
014:
015:        import java.util.List;
016:        import java.util.ArrayList;
017:        import java.util.Iterator;
018:        import java.util.logging.Logger;
019:        import java.util.logging.Level;
020:
021:        import javax.servlet.ServletException;
022:
023:        import javax.servlet.http.HttpServlet;
024:        import javax.servlet.http.HttpServletRequest;
025:        import javax.servlet.http.HttpServletResponse;
026:
027:        import java.io.PrintWriter;
028:
029:        import com.iplanet.sso.SSOToken;
030:
031:        import com.sun.portal.wsrp.producer.Producer;
032:        import com.sun.portal.wsrp.producer.ProducerManager;
033:        import com.sun.portal.wsrp.producer.ProducerException;
034:        import com.sun.portal.wsrp.producer.ISConnection;
035:        import com.sun.portal.log.common.PortalLogger;
036:
037:        public class WSDLServlet extends HttpServlet {
038:            private static final String CONTENT_TYPE_TEXT_XML = "text/xml";
039:
040:            private static final int MARKUP_SERVICE_TYPE = 0;
041:            private static final int SERVICEDESCRIPTION_SERVICE_TYPE = 1;
042:            private static final int REGISTRATION_SERVICE_TYPE = 2;
043:            private static final int PORTLETMANAGEMENT_SERVICE_TYPE = 3;
044:            private static final int UNKNOWN_SERVICE_TYPE = 4;
045:
046:            private static final String PRODUCER_KEY = "producerKey";
047:
048:            private static final String BINDINGS_WSDL_RURL = "/wsrp/specifications/version1/wsrp_v1_bindings.wsdl";
049:
050:            private static final String MARKUP_BINDING = "bind:WSRP_v1_Markup_Binding_SOAP";
051:            private static final String MARKUP_NAME = "WSRPBaseService";
052:            private static final String REGISTRATION_BINDING = "bind:WSRP_v1_Registration_Binding_SOAP";
053:            private static final String REGISTRATION_NAME = "WSRPRegistrationService";
054:            private static final String PORTLETMANAGEMENT_BINDING = "bind:WSRP_v1_PortletManagement_Binding_SOAP";
055:            private static final String PORTLETMANAGEMENT_NAME = "WSRPPortletManagementService";
056:            private static final String SERVICEDESCRIPTION_BINDING = "bind:WSRP_v1_ServiceDescription_Binding_SOAP";
057:            private static final String SERVICEDESCRIPTION_NAME = "WSRPServiceDescriptionService";
058:
059:            private static final String ROUTER_PREFIX = "/wsrp/router";
060:
061:            private static final String MARKUP = "markup";
062:            private static final String REGISTRATION = "registration";
063:            private static final String SERVICEDESCRIPTION = "servicedescription";
064:            private static final String PORTLETMANAGEMENT = "portletmanagement";
065:
066:            private static final String DEFAULT_PRODUCER_KEY = "default";
067:
068:            private static List SERVICES = null;
069:            private static Logger logger = PortalLogger
070:                    .getLogger(WSDLServlet.class);
071:
072:            static {
073:                SERVICES = new ArrayList();
074:                SERVICES.add(MARKUP);
075:                SERVICES.add(SERVICEDESCRIPTION);
076:                SERVICES.add(REGISTRATION);
077:                SERVICES.add(PORTLETMANAGEMENT);
078:            }
079:
080:            protected void doGet(HttpServletRequest req, HttpServletResponse res)
081:                    throws ServletException, java.io.IOException {
082:                res.setContentType(CONTENT_TYPE_TEXT_XML);
083:
084:                String producerKey = getProducerKey(req);
085:
086:                if (producerKey == null || producerKey.length() == 0) {
087:                    res.setStatus(HttpServletResponse.SC_NOT_ACCEPTABLE);
088:                } else {
089:                    String serverName = req.getServerName();
090:                    int serverPort = req.getServerPort();
091:                    String scheme = req.getScheme();
092:                    String contextPath = req.getContextPath();
093:
094:                    String urlPrefix = scheme + "://" + serverName + ":"
095:                            + serverPort + contextPath;
096:
097:                    PrintWriter p = res.getWriter();
098:
099:                    String bindingsURL = urlPrefix + BINDINGS_WSDL_RURL;
100:
101:                    p.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
102:                    p
103:                            .println("<wsdl:definitions targetNamespace=\"urn:oasis:names:tc:wsrp:v1:wsdl\" xmlns:bind=\"urn:oasis:names:tc:wsrp:v1:bind\" xmlns=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\">");
104:                    p
105:                            .println("<import namespace=\"urn:oasis:names:tc:wsrp:v1:bind\" location=\""
106:                                    + bindingsURL + "\"/>");
107:                    p.println("<wsdl:service name=\"WSRPService\">");
108:
109:                    String location = null;
110:                    String name = null;
111:                    String binding = null;
112:
113:                    for (Iterator i = SERVICES.iterator(); i.hasNext();) {
114:                        int serviceType = getServiceType((String) i.next());
115:
116:                        switch (serviceType) {
117:                        case MARKUP_SERVICE_TYPE:
118:                            location = urlPrefix + ROUTER_PREFIX + "/" + MARKUP
119:                                    + "/" + producerKey;
120:                            name = MARKUP_NAME;
121:                            binding = MARKUP_BINDING;
122:
123:                            break;
124:
125:                        case SERVICEDESCRIPTION_SERVICE_TYPE:
126:                            location = urlPrefix + ROUTER_PREFIX + "/"
127:                                    + SERVICEDESCRIPTION + "/" + producerKey;
128:                            name = SERVICEDESCRIPTION_NAME;
129:                            binding = SERVICEDESCRIPTION_BINDING;
130:
131:                            break;
132:
133:                        case PORTLETMANAGEMENT_SERVICE_TYPE:
134:                            location = urlPrefix + ROUTER_PREFIX + "/"
135:                                    + PORTLETMANAGEMENT + "/" + producerKey;
136:                            name = PORTLETMANAGEMENT_NAME;
137:                            binding = PORTLETMANAGEMENT_BINDING;
138:
139:                            break;
140:
141:                        case REGISTRATION_SERVICE_TYPE:
142:                            //
143:                            // if registration is not required, or if
144:                            // in-band registration is not supported,
145:                            // do not expose the registration port type
146:                            //
147:
148:                            try {
149:                                SSOToken adminToken = ISConnection
150:                                        .getAdminToken();
151:                                ProducerManager producerManager = new com.sun.portal.wsrp.producer.impl.ProducerManagerImpl(
152:                                        req, getServletConfig()
153:                                                .getServletContext(),
154:                                        adminToken);
155:                                Producer producer = producerManager
156:                                        .getProducer(producerKey);
157:
158:                                if (!producer.requiresRegistration()) {
159:                                    continue;
160:                                }
161:                                if (!producer.inbandRegistrationSupported()) {
162:                                    continue;
163:                                }
164:                            } catch (ProducerException pe) {
165:                                res.setStatus(HttpServletResponse.SC_NOT_FOUND);
166:                                logger.log(Level.SEVERE, "", pe);
167:                                return;
168:                            }
169:
170:                            // expose port type
171:
172:                            location = urlPrefix + ROUTER_PREFIX + "/"
173:                                    + REGISTRATION + "/" + producerKey;
174:                            name = REGISTRATION_NAME;
175:                            binding = REGISTRATION_BINDING;
176:
177:                            break;
178:                        }
179:
180:                        p.println("<wsdl:port binding=\"" + binding
181:                                + "\" name=\"" + name + "\">");
182:                        p.println("<soap:address location=\"" + location
183:                                + "\"/>");
184:                        p.println("</wsdl:port>");
185:                    }
186:
187:                    p.println("</wsdl:service>");
188:                    p.println("</wsdl:definitions>");
189:                }
190:            }
191:
192:            private int getServiceType(String s) {
193:                int serviceType;
194:
195:                if (s == null) {
196:                    serviceType = UNKNOWN_SERVICE_TYPE;
197:                } else if (s.equalsIgnoreCase(MARKUP)) {
198:                    serviceType = MARKUP_SERVICE_TYPE;
199:                } else if (s.equalsIgnoreCase(SERVICEDESCRIPTION)) {
200:                    serviceType = SERVICEDESCRIPTION_SERVICE_TYPE;
201:                } else if (s.equalsIgnoreCase(REGISTRATION)) {
202:                    serviceType = REGISTRATION_SERVICE_TYPE;
203:                } else if (s.equalsIgnoreCase(PORTLETMANAGEMENT)) {
204:                    serviceType = PORTLETMANAGEMENT_SERVICE_TYPE;
205:                } else {
206:                    serviceType = UNKNOWN_SERVICE_TYPE;
207:                }
208:
209:                return serviceType;
210:            }
211:
212:            private String getProducerKey(HttpServletRequest req)
213:                    throws ServletException {
214:                String pathinfo = req.getPathInfo();
215:                String producerKey = null;
216:
217:                if (pathinfo == null) {
218:                    producerKey = DEFAULT_PRODUCER_KEY;
219:                } else {
220:                    producerKey = pathinfo.substring(1);
221:                }
222:
223:                return producerKey;
224:            }
225:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.