Source Code Cross Referenced for ClientMessageHandlerTube.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.istack.Nullable;
004:        import com.sun.xml.ws.api.WSBinding;
005:        import com.sun.xml.ws.api.handler.MessageHandler;
006:        import com.sun.xml.ws.api.message.Attachment;
007:        import com.sun.xml.ws.api.message.AttachmentSet;
008:        import com.sun.xml.ws.api.message.Packet;
009:        import com.sun.xml.ws.api.model.SEIModel;
010:        import com.sun.xml.ws.api.model.wsdl.WSDLPort;
011:        import com.sun.xml.ws.api.pipe.Tube;
012:        import com.sun.xml.ws.api.pipe.TubeCloner;
013:        import com.sun.xml.ws.api.pipe.helper.AbstractFilterTubeImpl;
014:        import com.sun.xml.ws.binding.BindingImpl;
015:        import com.sun.xml.ws.client.HandlerConfiguration;
016:        import com.sun.xml.ws.message.DataHandlerAttachment;
017:
018:        import javax.activation.DataHandler;
019:        import javax.xml.ws.WebServiceException;
020:        import javax.xml.ws.handler.MessageContext;
021:        import javax.xml.ws.handler.Handler;
022:        import java.util.*;
023:
024:        /**
025:         * @author Rama Pulavarthi
026:         */
027:        public class ClientMessageHandlerTube extends HandlerTube {
028:            private SEIModel seiModel;
029:            private WSBinding binding;
030:            private Set<String> roles;
031:
032:            /**
033:             * Creates a new instance of MessageHandlerTube
034:             */
035:            public ClientMessageHandlerTube(@Nullable
036:            SEIModel seiModel, WSBinding binding, WSDLPort port, Tube next) {
037:                super (next, port);
038:                this .seiModel = seiModel;
039:                this .binding = binding;
040:            }
041:
042:            /**
043:             * Copy constructor for {@link com.sun.xml.ws.api.pipe.Tube#copy(com.sun.xml.ws.api.pipe.TubeCloner)}.
044:             */
045:            private ClientMessageHandlerTube(ClientMessageHandlerTube that,
046:                    TubeCloner cloner) {
047:                super (that, cloner);
048:                this .seiModel = that.seiModel;
049:                this .binding = that.binding;
050:            }
051:
052:            public AbstractFilterTubeImpl copy(TubeCloner cloner) {
053:                return new ClientMessageHandlerTube(this , cloner);
054:            }
055:
056:            void callHandlersOnResponse(MessageUpdatableContext context,
057:                    boolean handleFault) {
058:                try {
059:                    //CLIENT-SIDE
060:                    processor.callHandlersResponse(
061:                            HandlerProcessor.Direction.INBOUND, context,
062:                            handleFault);
063:
064:                } catch (WebServiceException wse) {
065:                    //no rewrapping
066:                    throw wse;
067:                } catch (RuntimeException re) {
068:                    throw new WebServiceException(re);
069:                }
070:            }
071:
072:            boolean callHandlersOnRequest(MessageUpdatableContext context,
073:                    boolean isOneWay) {
074:                boolean handlerResult;
075:
076:                //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message
077:                Map<String, DataHandler> atts = (Map<String, DataHandler>) context
078:                        .get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
079:                AttachmentSet attSet = packet.getMessage().getAttachments();
080:                for (String cid : atts.keySet()) {
081:                    if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice
082:                        Attachment att = new DataHandlerAttachment(cid, atts
083:                                .get(cid));
084:                        attSet.add(att);
085:                    }
086:                }
087:
088:                try {
089:                    //CLIENT-SIDE
090:                    handlerResult = processor.callHandlersRequest(
091:                            HandlerProcessor.Direction.OUTBOUND, context,
092:                            !isOneWay);
093:                } catch (WebServiceException wse) {
094:                    remedyActionTaken = true;
095:                    //no rewrapping
096:                    throw wse;
097:                } catch (RuntimeException re) {
098:                    remedyActionTaken = true;
099:
100:                    throw new WebServiceException(re);
101:
102:                }
103:                if (!handlerResult) {
104:                    remedyActionTaken = true;
105:                }
106:                return handlerResult;
107:            }
108:
109:            void closeHandlers(MessageContext mc) {
110:                closeClientsideHandlers(mc);
111:
112:            }
113:
114:            void setUpProcessor() {
115:                // Take a snapshot, User may change chain after invocation, Same chain
116:                // should be used for the entire MEP
117:                handlers = new ArrayList<Handler>();
118:                HandlerConfiguration handlerConfig = ((BindingImpl) binding)
119:                        .getHandlerConfig();
120:                List<MessageHandler> msgHandlersSnapShot = handlerConfig
121:                        .getMessageHandlers();
122:                if (!msgHandlersSnapShot.isEmpty()) {
123:                    handlers.addAll(msgHandlersSnapShot);
124:                    roles = new HashSet<String>();
125:                    roles.addAll(handlerConfig.getRoles());
126:                    processor = new SOAPHandlerProcessor(true, this , binding,
127:                            handlers);
128:                }
129:            }
130:
131:            MessageUpdatableContext getContext(Packet p) {
132:                MessageHandlerContextImpl context = new MessageHandlerContextImpl(
133:                        seiModel, binding, packet, roles);
134:                return context;
135:            }
136:
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.