1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
26 package com.sun.xml.internal.ws.binding; |
26 package com.sun.xml.internal.ws.binding; |
27 |
27 |
28 import com.sun.istack.internal.NotNull; |
28 import com.sun.istack.internal.NotNull; |
29 import com.sun.xml.internal.ws.api.BindingID; |
29 import com.sun.xml.internal.ws.api.BindingID; |
30 import com.sun.xml.internal.ws.api.SOAPVersion; |
30 import com.sun.xml.internal.ws.api.SOAPVersion; |
31 import com.sun.xml.internal.ws.api.addressing.AddressingVersion; |
|
32 import com.sun.xml.internal.ws.client.HandlerConfiguration; |
31 import com.sun.xml.internal.ws.client.HandlerConfiguration; |
33 import com.sun.xml.internal.ws.encoding.soap.streaming.SOAP12NamespaceConstants; |
32 import com.sun.xml.internal.ws.encoding.soap.streaming.SOAP12NamespaceConstants; |
34 import com.sun.xml.internal.ws.resources.ClientMessages; |
33 import com.sun.xml.internal.ws.resources.ClientMessages; |
35 |
34 |
36 import javax.xml.namespace.QName; |
35 import javax.xml.namespace.QName; |
41 import javax.xml.ws.WebServiceFeature; |
40 import javax.xml.ws.WebServiceFeature; |
42 import javax.xml.ws.handler.Handler; |
41 import javax.xml.ws.handler.Handler; |
43 import javax.xml.ws.soap.MTOMFeature; |
42 import javax.xml.ws.soap.MTOMFeature; |
44 import javax.xml.ws.soap.SOAPBinding; |
43 import javax.xml.ws.soap.SOAPBinding; |
45 import java.util.*; |
44 import java.util.*; |
46 |
|
47 |
45 |
48 /** |
46 /** |
49 * @author WS Development Team |
47 * @author WS Development Team |
50 */ |
48 */ |
51 public final class SOAPBindingImpl extends BindingImpl implements SOAPBinding { |
49 public final class SOAPBindingImpl extends BindingImpl implements SOAPBinding { |
116 * Sets the handlers on the binding and then sorts the handlers in to logical and protocol handlers. |
114 * Sets the handlers on the binding and then sorts the handlers in to logical and protocol handlers. |
117 * Creates a new HandlerConfiguration object and sets it on the BindingImpl. Also parses Headers understood by |
115 * Creates a new HandlerConfiguration object and sets it on the BindingImpl. Also parses Headers understood by |
118 * Protocol Handlers and sets the HandlerConfiguration. |
116 * Protocol Handlers and sets the HandlerConfiguration. |
119 */ |
117 */ |
120 public void setHandlerChain(List<Handler> chain) { |
118 public void setHandlerChain(List<Handler> chain) { |
121 handlerConfig = new HandlerConfiguration(handlerConfig.getRoles(), chain); |
119 setHandlerConfig(new HandlerConfiguration(getHandlerConfig().getRoles(), chain)); |
122 } |
120 } |
123 |
121 |
124 protected void addRequiredRoles(Set<String> roles) { |
122 protected void addRequiredRoles(Set<String> roles) { |
125 roles.addAll(soapVersion.requiredRoles); |
123 roles.addAll(soapVersion.requiredRoles); |
126 } |
124 } |
127 |
125 |
128 public Set<String> getRoles() { |
126 public Set<String> getRoles() { |
129 return handlerConfig.getRoles(); |
127 return getHandlerConfig().getRoles(); |
130 } |
128 } |
131 |
129 |
132 /** |
130 /** |
133 * Adds the next and other roles in case this has |
131 * Adds the next and other roles in case this has |
134 * been called by a user without them. |
132 * been called by a user without them. |
140 } |
138 } |
141 if (roles.contains(ROLE_NONE)) { |
139 if (roles.contains(ROLE_NONE)) { |
142 throw new WebServiceException(ClientMessages.INVALID_SOAP_ROLE_NONE()); |
140 throw new WebServiceException(ClientMessages.INVALID_SOAP_ROLE_NONE()); |
143 } |
141 } |
144 addRequiredRoles(roles); |
142 addRequiredRoles(roles); |
145 handlerConfig = new HandlerConfiguration(roles, getHandlerConfig()); |
143 setHandlerConfig(new HandlerConfiguration(roles, getHandlerConfig())); |
146 } |
144 } |
147 |
145 |
148 |
146 |
149 /** |
147 /** |
150 * Used typically by the runtime to enable/disable Mtom optimization |
148 * Used typically by the runtime to enable/disable Mtom optimization |