Source Code Cross Referenced for GeronimoServerTransport.java in  » ESB » celtix-1.0 » org » objectweb » celtix » geronimo » container » 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 » ESB » celtix 1.0 » org.objectweb.celtix.geronimo.container 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.objectweb.celtix.geronimo.container;
002:
003:        import java.io.IOException;
004:        import java.io.Serializable;
005:        import java.lang.reflect.Field;
006:        import java.util.LinkedList;
007:        import java.util.List;
008:        import java.util.Map;
009:        import java.util.StringTokenizer;
010:        import java.util.logging.Logger;
011:
012:        import javax.wsdl.WSDLException;
013:        import javax.xml.ws.handler.MessageContext;
014:
015:        import org.apache.geronimo.webservices.WebServiceContainer.Request;
016:        import org.apache.geronimo.webservices.WebServiceContainer.Response;
017:        import org.objectweb.celtix.Bus;
018:        import org.objectweb.celtix.bus.transports.http.AbstractHTTPServerTransport;
019:        import org.objectweb.celtix.context.OutputStreamMessageContext;
020:        import org.objectweb.celtix.transports.ServerTransportCallback;
021:        import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
022:
023:        public class GeronimoServerTransport extends
024:                AbstractHTTPServerTransport implements  Serializable {
025:
026:            private static final Logger LOG = Logger
027:                    .getLogger(GeronimoServerTransport.class.getName());
028:
029:            public GeronimoServerTransport(Bus bus,
030:                    EndpointReferenceType address) throws WSDLException,
031:                    IOException {
032:                super (bus, address);
033:            }
034:
035:            public void invoke(Request request, Response response) {
036:                assert callback != null : "callback is null";
037:
038:                GeronimoInputStreamMessageContext msgCtx = createInputStreamMessageContext();
039:                msgCtx.setRequest(request);
040:                msgCtx.setResponse(response);
041:                callback.dispatch(msgCtx, this );
042:            }
043:
044:            public void activate(ServerTransportCallback aCallback)
045:                    throws IOException {
046:                LOG.fine("geronimo server transport activating: " + callback);
047:                callback = aCallback;
048:            }
049:
050:            public void deactivate() throws IOException {
051:                System.out.println("geronimo server transport deactivating");
052:            }
053:
054:            public OutputStreamMessageContext rebase(MessageContext context,
055:                    EndpointReferenceType decoupledResponseEndpoint)
056:                    throws IOException {
057:                // TODO Auto-generated method stub
058:                return null;
059:            }
060:
061:            public void postDispatch(MessageContext bindingContext,
062:                    OutputStreamMessageContext context) {
063:                System.out.println("geronimo server transport postDispatch");
064:            }
065:
066:            public void shutdown() {
067:                // TODO Auto-generated method stub
068:
069:            }
070:
071:            public OutputStreamMessageContext createOutputStreamContext(
072:                    MessageContext context) throws IOException {
073:                return new GeronimoOutputStreamServerMessageContext(context);
074:            }
075:
076:            public void finalPrepareOutputStreamContext(
077:                    OutputStreamMessageContext context) throws IOException {
078:                // do nothing 
079:            }
080:
081:            @Override
082:            protected void copyRequestHeaders(MessageContext ctx,
083:                    Map<String, List<String>> headers) {
084:                assert ctx instanceof  GeronimoInputStreamMessageContext;
085:                GeronimoInputStreamMessageContext gctx = (GeronimoInputStreamMessageContext) ctx;
086:                Request req = gctx.getRequest();
087:
088:                // no map of headers so just find all static field constants that begin with HEADER_, get
089:                // its value and get the corresponding header.
090:                for (Field field : Request.class.getFields()) {
091:                    if (field.getName().startsWith("HEADER_")) {
092:                        try {
093:                            assert field.getType().equals(String.class) : "unexpected field type";
094:                            String headerName = (String) field.get(null);
095:                            String headerValue = req.getHeader(headerName);
096:                            if (headerValue != null) {
097:                                List<String> values = headers.get(headerName);
098:                                if (values == null) {
099:                                    values = new LinkedList<String>();
100:                                    headers.put(headerName, values);
101:                                }
102:                                values
103:                                        .addAll(splitMultipleHeaderValues(headerValue));
104:                            }
105:                        } catch (IllegalAccessException ex) {
106:                            // ignore 
107:                        }
108:                    }
109:                }
110:            }
111:
112:            private List<String> splitMultipleHeaderValues(String value) {
113:
114:                List<String> allValues = new LinkedList<String>();
115:                if (value.contains(",")) {
116:                    StringTokenizer st = new StringTokenizer(value, ",");
117:                    while (st.hasMoreTokens()) {
118:                        allValues.add(st.nextToken().trim());
119:                    }
120:
121:                } else {
122:                    allValues.add(value);
123:                }
124:                return allValues;
125:            }
126:
127:            protected GeronimoInputStreamMessageContext createInputStreamMessageContext() {
128:                return new GeronimoInputStreamMessageContext();
129:            }
130:
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.