Source Code Cross Referenced for ServerMessageHandlerTube.java in  » 6.0-JDK-Modules » jax-ws-runtime » com » sun » xml » ws » handler » 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 » 6.0 JDK Modules » jax ws runtime » com.sun.xml.ws.handler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.sun.xml.ws.handler;
002:
003:        import com.sun.xml.ws.api.WSBinding;
004:        import com.sun.xml.ws.api.handler.MessageHandler;
005:        import com.sun.xml.ws.api.message.Attachment;
006:        import com.sun.xml.ws.api.message.AttachmentSet;
007:        import com.sun.xml.ws.api.message.Packet;
008:        import com.sun.xml.ws.api.model.SEIModel;
009:        import com.sun.xml.ws.api.pipe.Tube;
010:        import com.sun.xml.ws.api.pipe.TubeCloner;
011:        import com.sun.xml.ws.api.pipe.helper.AbstractFilterTubeImpl;
012:        import com.sun.xml.ws.binding.BindingImpl;
013:        import com.sun.xml.ws.client.HandlerConfiguration;
014:        import com.sun.xml.ws.message.DataHandlerAttachment;
015:
016:        import javax.activation.DataHandler;
017:        import javax.xml.ws.WebServiceException;
018:        import javax.xml.ws.handler.MessageContext;
019:        import javax.xml.ws.handler.Handler;
020:        import java.util.*;
021:
022:        /**
023:         * @author Rama Pulavarthi
024:         */
025:        public class ServerMessageHandlerTube extends HandlerTube {
026:            private SEIModel seiModel;
027:            private WSBinding binding;
028:            private Set<String> roles;
029:
030:            // Handle to LogicalHandlerTube means its used on SERVER-SIDE
031:
032:            /**
033:             * This constructor is used on client-side where, LogicalHandlerTube is created
034:             * first and then a SOAPHandlerTube is created with a handler to that
035:             * LogicalHandlerTube.
036:             * With this handle, SOAPHandlerTube can call LogicalHandlerTube.closeHandlers()
037:             */
038:            public ServerMessageHandlerTube(SEIModel seiModel,
039:                    WSBinding binding, Tube next, HandlerTube cousinTube) {
040:                super (next, cousinTube);
041:                this .seiModel = seiModel;
042:                this .binding = binding;
043:                setUpProcessorOnce();
044:            }
045:
046:            /**
047:             * Copy constructor for {@link com.sun.xml.ws.api.pipe.Tube#copy(com.sun.xml.ws.api.pipe.TubeCloner)}.
048:             */
049:            private ServerMessageHandlerTube(ServerMessageHandlerTube that,
050:                    TubeCloner cloner) {
051:                super (that, cloner);
052:                this .seiModel = that.seiModel;
053:                this .binding = that.binding;
054:                setUpProcessorOnce();
055:            }
056:
057:            private void setUpProcessorOnce() {
058:                handlers = new ArrayList<Handler>();
059:                HandlerConfiguration handlerConfig = ((BindingImpl) binding)
060:                        .getHandlerConfig();
061:                List<MessageHandler> msgHandlersSnapShot = handlerConfig
062:                        .getMessageHandlers();
063:                if (!msgHandlersSnapShot.isEmpty()) {
064:                    handlers.addAll(msgHandlersSnapShot);
065:                    roles = new HashSet<String>();
066:                    roles.addAll(handlerConfig.getRoles());
067:                    processor = new SOAPHandlerProcessor(false, this , binding,
068:                            handlers);
069:                }
070:            }
071:
072:            void callHandlersOnResponse(MessageUpdatableContext context,
073:                    boolean handleFault) {
074:                //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message
075:                Map<String, DataHandler> atts = (Map<String, DataHandler>) context
076:                        .get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
077:                AttachmentSet attSet = packet.getMessage().getAttachments();
078:                for (String cid : atts.keySet()) {
079:                    if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice
080:                        Attachment att = new DataHandlerAttachment(cid, atts
081:                                .get(cid));
082:                        attSet.add(att);
083:                    }
084:                }
085:
086:                try {
087:                    //SERVER-SIDE
088:                    processor.callHandlersResponse(
089:                            HandlerProcessor.Direction.OUTBOUND, context,
090:                            handleFault);
091:
092:                } catch (WebServiceException wse) {
093:                    //no rewrapping
094:                    throw wse;
095:                } catch (RuntimeException re) {
096:                    throw re;
097:
098:                }
099:            }
100:
101:            boolean callHandlersOnRequest(MessageUpdatableContext context,
102:                    boolean isOneWay) {
103:                boolean handlerResult;
104:                try {
105:                    //SERVER-SIDE
106:                    handlerResult = processor.callHandlersRequest(
107:                            HandlerProcessor.Direction.INBOUND, context,
108:                            !isOneWay);
109:
110:                } catch (RuntimeException re) {
111:                    remedyActionTaken = true;
112:                    throw re;
113:
114:                }
115:                if (!handlerResult) {
116:                    remedyActionTaken = true;
117:                }
118:                return handlerResult;
119:            }
120:
121:            void setUpProcessor() {
122:                // Do nothing, Processor is setup in the constructor.
123:            }
124:
125:            void closeHandlers(MessageContext mc) {
126:                closeServersideHandlers(mc);
127:
128:            }
129:
130:            MessageUpdatableContext getContext(Packet packet) {
131:                MessageHandlerContextImpl context = new MessageHandlerContextImpl(
132:                        seiModel, binding, packet, roles);
133:                return context;
134:            }
135:
136:            //should be overridden by DriverHandlerTubes
137:            @Override
138:            protected void initiateClosing(MessageContext mc) {
139:                close(mc);
140:                super .initiateClosing(mc);
141:            }
142:
143:            public AbstractFilterTubeImpl copy(TubeCloner cloner) {
144:                return new ServerMessageHandlerTube(this, cloner);
145:            }
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.