Author: jason.greene(a)jboss.com
Date: 2007-03-16 03:19:47 -0400 (Fri, 16 Mar 2007)
New Revision: 2629
Added:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/MimeHeaderSource.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServerHandlerDelegate.java
Removed:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/HandlerDelegate.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/HeaderSource.java
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServletHeaderSource.java
trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/Constants.java
trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandler.java
trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/jaxws/WSSecurityHandler.java
Log:
refactor mustUnderstand processing on the client
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java 2007-03-16 00:53:02
UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java 2007-03-16 07:19:47
UTC (rev 2629)
@@ -28,7 +28,7 @@
import javax.xml.namespace.QName;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.server.HandlerDelegate;
+import org.jboss.ws.core.server.ServerHandlerDelegate;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -55,5 +55,5 @@
/** bind an exception to a fault message */
Object bindFaultMessage(Exception ex);
- void setHandlerDelegate(HandlerDelegate delegate);
+ void setHeaderSource(HeaderSource source);
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-03-16 00:53:02
UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-03-16 07:19:47
UTC (rev 2629)
@@ -71,7 +71,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 10-Oct-2004
*/
-public abstract class CommonClient implements StubExt
+public abstract class CommonClient implements StubExt, HeaderSource
{
// provide logging
private static Logger log = Logger.getLogger(CommonClient.class);
@@ -258,6 +258,7 @@
{
// Get the binding from the provider
CommonBinding binding =
(CommonBinding)getCommonBindingProvider().getCommonBinding();
+ binding.setHeaderSource(this);
// Create the invocation and sync the input parameters
epInv = new EndpointInvocation(opMetaData);
@@ -330,6 +331,10 @@
Object retObj = null;
if (oneway == false && handlerPass)
{
+ // Verify
+ if (binding instanceof CommonSOAPBinding)
+ ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
+
// Call the response handlers
handlerPass = callResponseHandlerChain(portName, HandlerType.POST);
@@ -344,10 +349,6 @@
handlerPass = handlerPass && callResponseHandlerChain(portName,
HandlerType.ENDPOINT);
handlerPass = handlerPass && callResponseHandlerChain(portName,
HandlerType.PRE);
- // BP-1.0 R1027
- if (handlerPass)
- HandlerChainBaseImpl.checkMustUnderstand(reqContext, new String[] {});
-
// Check if protocol handlers modified the payload
if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
{
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java 2007-03-16
00:53:02 UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -76,7 +76,7 @@
Set<String> roles = getRoles();
boolean isActor = actor == null || actor.length() == 0 ||
Constants.URI_SOAP11_NEXT_ACTOR.equals(actor) || roles.contains(actor);
- if (isActor && !handlerDelegate.getHeaders().contains(name))
+ if (isActor && !headerSource.getHeaders().contains(name))
{
QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
String faultString = "Unprocessed 'mustUnderstand' header element:
" + element.getElementName();
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java 2007-03-16
00:53:02 UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -69,7 +69,7 @@
Set<String> roles = getRoles();
boolean isActor = actor == null || actor.length() == 0 ||
Constants.URI_SOAP11_NEXT_ACTOR.equals(actor) || roles.contains(actor);
- if (isActor && !handlerDelegate.getHeaders().contains(name))
+ if (isActor && !headerSource.getHeaders().contains(name))
{
// How do we pass NotUnderstood blocks? They are not in the fault element
QName faultCode = SOAPConstants.SOAP_MUSTUNDERSTAND_FAULT;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-03-16
00:53:02 UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -56,7 +56,7 @@
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.server.HandlerDelegate;
+import org.jboss.ws.core.server.ServerHandlerDelegate;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.NameImpl;
@@ -95,7 +95,7 @@
private boolean mtomEnabled;
- protected HandlerDelegate handlerDelegate;
+ protected HeaderSource headerSource;
/** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
public static final String SOAP11HTTP_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http";
@@ -837,9 +837,9 @@
}
}
- public void setHandlerDelegate(HandlerDelegate delegate)
+ public void setHeaderSource(HeaderSource source)
{
- handlerDelegate = delegate;
+ headerSource = source;
}
private void handleException(Exception ex) throws BindingException
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -25,14 +25,10 @@
import java.util.Set;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeaderElement;
import javax.xml.soap.SOAPMessage;
-import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonSOAP11Binding;
+import org.jboss.ws.core.RoleSource;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -71,9 +67,9 @@
@Override
public Set<String> getRoles()
{
- if (!(handlerDelegate instanceof HandlerDelegateJAXRPC))
- throw new IllegalStateException("HandlerDelegateJAXRPC was not
available");
+ if (!(headerSource instanceof RoleSource))
+ throw new IllegalStateException("RoleSource was not available");
- return ((HandlerDelegateJAXRPC)handlerDelegate).getRoles();
+ return ((RoleSource)headerSource).getRoles();
}
}
\ No newline at end of file
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -28,6 +28,7 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.core.CommonSOAP12Binding;
+import org.jboss.ws.core.RoleSource;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -61,10 +62,10 @@
@Override
public Set<String> getRoles()
{
- if (!(handlerDelegate instanceof HandlerDelegateJAXRPC))
- throw new IllegalStateException("HandlerDelegateJAXRPC was not
available");
+ if (!(headerSource instanceof RoleSource))
+ throw new IllegalStateException("RoleSource was not available");
- return ((HandlerDelegateJAXRPC)handlerDelegate).getRoles();
+ return ((RoleSource)headerSource).getRoles();
}
protected void throwFaultException(SOAPFaultImpl fault) throws Exception
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java 2007-03-16
00:53:02 UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -26,6 +26,7 @@
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -48,6 +49,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonClient;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.RoleSource;
import org.jboss.ws.core.WSTimeoutException;
import org.jboss.ws.core.jaxrpc.SchemaGenerator;
import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
@@ -76,7 +78,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 10-Oct-2004
*/
-public class CallImpl extends CommonClient implements Call
+public class CallImpl extends CommonClient implements Call, RoleSource
{
// provide logging
private static Logger log = Logger.getLogger(CallImpl.class);
@@ -650,4 +652,23 @@
// Reinitialize the client handler chain
jaxrpcService.setupHandlerChain(epMetaData);
}
-}
+
+ public Set<QName> getHeaders()
+ {
+ HandlerChainBaseImpl handlerChain =
(HandlerChainBaseImpl)jaxrpcService.getHandlerChain(epMetaData.getPortName());
+
+ return (handlerChain != null) ? handlerChain.getHeaders() : new
HashSet<QName>();
+ }
+
+ public Set<String> getRoles()
+ {
+ HandlerChainBaseImpl handlerChain =
(HandlerChainBaseImpl)jaxrpcService.getHandlerChain(epMetaData.getPortName());
+
+ Set<String> set = new HashSet<String>();
+ String[] roles = handlerChain.getRoles();
+ if (roles != null)
+ Collections.addAll(set, roles);
+
+ return set;
+ }
+}
\ No newline at end of file
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -117,6 +117,13 @@
Collections.addAll(headers, handlerHeaders);
}
}
+
+ public Set<QName> getHeaders()
+ {
+ HashSet<QName> set = new HashSet<QName>();
+ pullHeaders(set);
+ return set;
+ }
/**
* Initialize the a handler chain with the given handlers infos
@@ -521,70 +528,6 @@
}
/**
- * R1027 A RECEIVER MUST generate a "soap:MustUnderstand" fault when a
- * message contains a mandatory header block (i.e., one that has a
- * soap:mustUnderstand attribute with the value "1") targeted at the
- * receiver (via soap:actor) that the receiver does not understand.
- */
- public static void checkMustUnderstand(CommonMessageContext msgContext, String[]
roles)
- {
- SOAPHeaderElement mustUnderstandHeaderElement = null;
- List roleList = (roles != null ? Arrays.asList(roles) : new ArrayList());
- try
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
-
- // A SOAPHeaderElement is possibly bound to the endpoint operation
- // in order to check that we need a the opMetaData
- OperationMetaData opMetaData = msgContext.getOperationMetaData();
- if (opMetaData == null)
- {
- // The security handler must have decrypted the incomming message
- // before the dispatch target operation can be known
- EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- opMetaData = soapMessage.getOperationMetaData(epMetaData);
- }
-
- SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
- if (soapEnvelope != null && soapEnvelope.getHeader() != null)
- {
- Iterator it = soapEnvelope.getHeader().examineAllHeaderElements();
- while (it.hasNext() && mustUnderstandHeaderElement == null)
- {
- SOAPHeaderElement soapHeaderElement = (SOAPHeaderElement)it.next();
- Name name = soapHeaderElement.getElementName();
- QName xmlName = new QName(name.getURI(), name.getLocalName());
-
- ParameterMetaData paramMetaData = (opMetaData != null ?
opMetaData.getParameter(xmlName) : null);
- boolean isBoundHeader = (paramMetaData != null &&
paramMetaData.isInHeader());
-
- if (soapHeaderElement.getMustUnderstand() && isBoundHeader ==
false)
- {
- String actor = soapHeaderElement.getActor();
- boolean noActor = (actor == null || actor.length() == 0);
- boolean nextActor = Constants.URI_SOAP11_NEXT_ACTOR.equals(actor);
- if (noActor || nextActor || roleList.contains(actor))
- {
- mustUnderstandHeaderElement = soapHeaderElement;
- }
- }
- }
- }
- }
- catch (SOAPException ex)
- {
- log.error("Cannot check mustUnderstand for headers", ex);
- }
-
- if (mustUnderstandHeaderElement != null)
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
- String faultString = "Unprocessed 'mustUnderstand' header element:
" + mustUnderstandHeaderElement.getElementName();
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- }
-
- /**
* An entry in the handler list
*/
private class HandlerEntry
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -36,7 +36,7 @@
import javax.xml.rpc.handler.HandlerInfo;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.server.HandlerDelegate;
+import org.jboss.ws.core.server.ServerHandlerDelegate;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.extensions.xop.XOPContext;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedInitParamMetaData;
@@ -50,7 +50,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 19-Jan-2005
*/
-public class HandlerDelegateJAXRPC extends HandlerDelegate
+public class HandlerDelegateJAXRPC extends ServerHandlerDelegate
{
// provide logging
private static Logger log = Logger.getLogger(HandlerDelegateJAXRPC.class);
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -33,8 +33,8 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.HeaderSource;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
-import org.jboss.ws.core.server.HandlerDelegate;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
@@ -99,7 +99,7 @@
throw new NotImplementedException();
}
- public void setHandlerDelegate(HandlerDelegate delegate)
+ public void setHeaderSource(HeaderSource source)
{
// Not needed
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -36,10 +36,11 @@
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.HeaderSource;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.HandlerDelegate;
+import org.jboss.ws.core.server.ServerHandlerDelegate;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -174,7 +175,7 @@
throw new NotImplementedException();
}
- public void setHandlerDelegate(HandlerDelegate delegate)
+ public void setHeaderSource(HeaderSource source)
{
// Not needed
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -38,10 +38,11 @@
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.HeaderSource;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.HandlerDelegate;
+import org.jboss.ws.core.server.ServerHandlerDelegate;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPBodyImpl;
@@ -189,7 +190,7 @@
throw new NotImplementedException();
}
- public void setHandlerDelegate(HandlerDelegate delegate)
+ public void setHeaderSource(HeaderSource source)
{
// Not neeeded
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2007-03-16
00:53:02 UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -25,9 +25,11 @@
import java.rmi.RemoteException;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Observable;
+import java.util.Set;
import javax.xml.namespace.QName;
import javax.xml.ws.Binding;
@@ -37,6 +39,7 @@
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.HandlerResolver;
import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.http.HTTPException;
import javax.xml.ws.soap.SOAPBinding;
@@ -47,7 +50,6 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonClient;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.StubExt;
import org.jboss.ws.core.jaxws.binding.BindingExt;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
import org.jboss.ws.core.jaxws.handler.HandlerChainExecutor;
@@ -56,7 +58,6 @@
import org.jboss.ws.core.jaxws.handler.PortInfoImpl;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.extensions.xop.XOPContext;
import org.jboss.ws.metadata.config.Configurable;
import org.jboss.ws.metadata.config.ConfigurationProvider;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
@@ -331,4 +332,21 @@
ConfigurationProvider configProvider =
(ConfigurationProvider)getEndpointMetaData();
configProvider.setConfigName(configName, configFile);
}
-}
+
+ public Set<QName> getHeaders()
+ {
+ if (handlerResolver instanceof HandlerResolverImpl)
+ return ((HandlerResolverImpl)handlerResolver).getHeaders();
+
+ Set<QName> headers = new HashSet<QName>();
+ List<Handler> handlerChain = handlerResolver.getHandlerChain(new
PortInfoImpl(epMetaData));
+ if (handlerChain != null)
+ {
+ for (Handler handler : handlerChain)
+ if (handler instanceof SOAPHandler)
+ headers.addAll(((SOAPHandler)handler).getHeaders());
+ }
+
+ return headers;
+ }
+}
\ No newline at end of file
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -33,7 +33,7 @@
import javax.xml.ws.handler.PortInfo;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.server.HandlerDelegate;
+import org.jboss.ws.core.server.ServerHandlerDelegate;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
@@ -45,7 +45,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 19-Jan-2005
*/
-public class HandlerDelegateJAXWS extends HandlerDelegate
+public class HandlerDelegateJAXWS extends ServerHandlerDelegate
{
// provide logging
private static Logger log = Logger.getLogger(HandlerDelegateJAXWS.class);
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -73,7 +73,7 @@
protected ServiceEndpointInfo seInfo;
protected CommonBindingProvider bindingProvider;
- protected HandlerDelegate delegate;
+ protected ServerHandlerDelegate delegate;
/** Initialize the service endpoint */
public void init(ServiceEndpointInfo seInfo)
@@ -147,7 +147,7 @@
EndpointInvocation epInv = null;
OperationMetaData opMetaData = null;
CommonBinding binding = bindingProvider.getCommonBinding();
- binding.setHandlerDelegate(delegate);
+ binding.setHeaderSource(delegate);
// call the handler chain
boolean handlersPass = callRequestHandlerChain(sepMetaData, HandlerType.PRE);
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/server/HandlerDelegate.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/HandlerDelegate.java 2007-03-16
00:53:02 UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/HandlerDelegate.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.server;
-
-// $Id$
-
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.metadata.config.Configurable;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-
-/**
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-Jan-2005
- */
-public abstract class HandlerDelegate implements Configurable
-{
- private ServerEndpointMetaData sepMetaData;
-
- public HandlerDelegate(ServerEndpointMetaData sepMetaData)
- {
- this.sepMetaData = sepMetaData;
- }
-
- public abstract boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type);
-
- public abstract boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type);
-
- public abstract boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type, Exception ex);
-
- public abstract void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type);
-
- protected boolean isInitialized()
- {
- return sepMetaData.isHandlersInitialized();
- }
-
- protected void setInitialized(boolean flag)
- {
- sepMetaData.setHandlersInitialized(flag);
- }
-
- public abstract Set<QName> getHeaders();
-}
Deleted: trunk/jbossws-core/src/java/org/jboss/ws/core/server/HeaderSource.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/HeaderSource.java 2007-03-16
00:53:02 UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/HeaderSource.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -1,49 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.ws.core.server;
-
-import javax.xml.soap.MimeHeaders;
-
-/**
- * Generic abstraction of a source that allows getting and setting
- * of transport specific MIME headers.
- *
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- */
-public interface HeaderSource
-{
- /**
- * Gets the MIME headers from an inbound source. An implementation may
- * return <code>null</code> if the transport does not provide headers.
- *
- * @return the MIME headers
- */
- public MimeHeaders getMimeHeaders();
-
- /**
- * Sets the MIME headers for an outbound source. An implementation may
- * return <code>null</code> if the transport does not provide headers.
- *
- * @param headers the MIME headers
- */
- public void setMimeHeaders(MimeHeaders headers);
-}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/MimeHeaderSource.java (from
rev 2628, trunk/jbossws-core/src/java/org/jboss/ws/core/server/HeaderSource.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/MimeHeaderSource.java
(rev 0)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/MimeHeaderSource.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.core.server;
+
+import javax.xml.soap.MimeHeaders;
+
+/**
+ * Generic abstraction of a source that allows getting and setting
+ * of transport specific MIME headers.
+ *
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ */
+public interface MimeHeaderSource
+{
+ /**
+ * Gets the MIME headers from an inbound source. An implementation may
+ * return <code>null</code> if the transport does not provide headers.
+ *
+ * @return the MIME headers
+ */
+ public MimeHeaders getMimeHeaders();
+
+ /**
+ * Sets the MIME headers for an outbound source. An implementation may
+ * return <code>null</code> if the transport does not provide headers.
+ *
+ * @param headers the MIME headers
+ */
+ public void setMimeHeaders(MimeHeaders headers);
+}
Copied: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServerHandlerDelegate.java
(from rev 2628,
trunk/jbossws-core/src/java/org/jboss/ws/core/server/HandlerDelegate.java)
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServerHandlerDelegate.java
(rev 0)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServerHandlerDelegate.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.server;
+
+// $Id$
+
+import org.jboss.ws.core.HeaderSource;
+import org.jboss.ws.metadata.config.Configurable;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 19-Jan-2005
+ */
+public abstract class ServerHandlerDelegate implements Configurable, HeaderSource
+{
+ private ServerEndpointMetaData sepMetaData;
+
+ public ServerHandlerDelegate(ServerEndpointMetaData sepMetaData)
+ {
+ this.sepMetaData = sepMetaData;
+ }
+
+ public abstract boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type);
+
+ public abstract boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type);
+
+ public abstract boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type, Exception ex);
+
+ public abstract void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type);
+
+ protected boolean isInitialized()
+ {
+ return sepMetaData.isHandlersInitialized();
+ }
+
+ protected void setInitialized(boolean flag)
+ {
+ sepMetaData.setHandlersInitialized(flag);
+ }
+}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-03-16
00:53:02 UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -157,7 +157,7 @@
/**
* Handle a request to this web service endpoint
*/
- public SOAPMessage handleRequest(HeaderSource headerSource, EndpointContext context,
InputStream inputStream) throws BindingException
+ public SOAPMessage handleRequest(MimeHeaderSource headerSource, EndpointContext
context, InputStream inputStream) throws BindingException
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
@@ -256,7 +256,7 @@
/** Set response mime headers
*/
- private void postProcessResponse(HeaderSource headerSource, SOAPMessage resMessage)
+ private void postProcessResponse(MimeHeaderSource headerSource, SOAPMessage
resMessage)
{
try
{
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServletHeaderSource.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServletHeaderSource.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServletHeaderSource.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -42,7 +42,7 @@
* @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
* @author Thomas.Diesler(a)jboss.org
*/
-public class ServletHeaderSource implements HeaderSource
+public class ServletHeaderSource implements MimeHeaderSource
{
private HttpServletRequest req;
private HttpServletResponse res;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/Constants.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/Constants.java 2007-03-16
00:53:02 UTC (rev 2628)
+++ trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/Constants.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.extensions.security;
+import javax.xml.namespace.QName;
+
import org.apache.xml.security.utils.EncryptionConstants;
@@ -67,4 +69,6 @@
public static final String XENC_ELEMENT_TYPE = EncryptionConstants.TYPE_ELEMENT;
public static final String XENC_CONTENT_TYPE = EncryptionConstants.TYPE_CONTENT;
+
+ public static final QName WSSE_HEADER_QNAME = new QName(WSSE_NS,
"Security");
}
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandler.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandler.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/jaxrpc/WSSecurityHandler.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -33,6 +33,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.extensions.security.Constants;
import org.jboss.ws.extensions.security.WSSecurityDispatcher;
import org.jboss.ws.integration.UnifiedVirtualFile;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
@@ -53,7 +54,7 @@
public QName[] getHeaders()
{
- return null;
+ return new QName[] {Constants.WSSE_HEADER_QNAME};
}
protected boolean handleInboundSecurity(MessageContext msgContext)
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/jaxws/WSSecurityHandler.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/jaxws/WSSecurityHandler.java 2007-03-16
00:53:02 UTC (rev 2628)
+++
trunk/jbossws-core/src/java/org/jboss/ws/extensions/security/jaxws/WSSecurityHandler.java 2007-03-16
07:19:47 UTC (rev 2629)
@@ -24,7 +24,11 @@
// $Id$
import java.io.IOException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.ws.handler.MessageContext;
@@ -32,6 +36,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
+import org.jboss.ws.extensions.security.Constants;
import org.jboss.ws.extensions.security.WSSecurityDispatcher;
import org.jboss.ws.integration.UnifiedVirtualFile;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
@@ -49,6 +54,20 @@
{
// provide logging
private static Logger log = Logger.getLogger(WSSecurityHandler.class);
+
+ private static Set<QName> headers;
+
+ static
+ {
+ HashSet<QName> set = new HashSet<QName>();
+ set.add(Constants.WSSE_HEADER_QNAME);
+ headers = Collections.unmodifiableSet(set);
+ }
+
+ public Set<QName> getHeaders()
+ {
+ return headers;
+ }
protected boolean handleInboundSecurity(MessageContext msgContext)
{