Author: thomas.diesler(a)jboss.com
Date: 2007-03-13 14:20:48 -0400 (Tue, 13 Mar 2007)
New Revision: 2609
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/handlerchain/jaxws-handlers.xml
Removed:
trunk/jbossws-tests/src/resources/jaxws/samples/handlerchain/jaxws-handlers.xml
Modified:
trunk/build/version.properties
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB21.java
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.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/client/ClientImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerChainExecutor.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/HandlerDelegate.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.java
Log:
Implement jaxws handler lifecycle close(), @PostConstruct
Modified: trunk/build/version.properties
===================================================================
--- trunk/build/version.properties 2007-03-13 15:14:03 UTC (rev 2608)
+++ trunk/build/version.properties 2007-03-13 18:20:48 UTC (rev 2609)
@@ -5,8 +5,8 @@
specification.vendor=JBoss (
http://www.jboss.org)
specification.version=jbossws-1.2
-version.id=2.0.0.DEV
-repository.id=snapshot
+version.id=2.0.0.CR5
+repository.id=2.0.0.CR5
implementation.title=JBoss Web Services (JBossWS)
implementation.url=http://www.jboss.org/products/jbossws
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB21.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -148,13 +148,13 @@
}
/** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
+ public Object createServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
{
return null;
}
/** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws Exception
+ public void invokeServiceEndpointInstance(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws Exception
{
log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
@@ -195,7 +195,7 @@
}
/** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
+ public void destroyServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
seiImpl)
{
// do nothing
}
@@ -219,6 +219,13 @@
}
/** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public void closeHandlerChain(ServiceEndpointInfo seInfo)
+ {
+ if (type == HandlerType.PRE)
+ handlerDelegate.closeHandlerChain(seInfo);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type,
Exception ex)
{
if (type == HandlerType.PRE)
@@ -256,6 +263,13 @@
}
/** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public void closeHandlerChain(HandlerType type)
+ {
+ if (type != HandlerType.PRE)
+ handlerDelegate.closeHandlerChain(seInfo);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
public boolean callFaultHandlerChain(HandlerType type, Exception ex)
{
if (type == HandlerType.PRE)
@@ -263,6 +277,5 @@
else
return handlerDelegate.callFaultHandlerChain(seInfo, type, ex);
}
-
}
}
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerEJB3.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -87,13 +87,13 @@
}
/** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
+ public Object createServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
{
return null;
}
/** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws Exception
+ public void invokeServiceEndpointInstance(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws Exception
{
log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
try
@@ -122,7 +122,7 @@
}
/** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
+ public void destroyServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
seiImpl)
{
// do nothing
}
Modified:
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java
===================================================================
---
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInvokerMDB.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -58,13 +58,13 @@
/** Create an instance of the SEI implementation bean if necessary
*/
- public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass) throws InstantiationException,
IllegalAccessException
+ public Object createServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass) throws InstantiationException,
IllegalAccessException
{
return ThreadLocalAssociation.localInvokerMDBAssoc().get();
}
/** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws Exception
+ public void invokeServiceEndpointInstance(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws Exception
{
log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
try
@@ -89,7 +89,7 @@
}
/** Destroy an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
+ public void destroyServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
seiImpl)
{
}
}
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB21.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB21.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB21.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -148,13 +148,13 @@
}
/** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
+ public Object createServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
{
return null;
}
/** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws Exception
+ public void invokeServiceEndpointInstance(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws Exception
{
log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
@@ -195,7 +195,7 @@
}
/** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
+ public void destroyServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
seiImpl)
{
// do nothing
}
Modified:
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
===================================================================
---
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -97,13 +97,13 @@
}
/** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
+ public Object createServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
endpointContext, Class seiImplClass)
{
return null;
}
/** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object beanInstance,
EndpointInvocation epInv) throws SOAPFaultException, Exception
+ public void invokeServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
beanInstance, EndpointInvocation epInv) throws SOAPFaultException, Exception
{
log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
@@ -137,7 +137,7 @@
}
/** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
+ public void destroyServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
seiImpl)
{
// do nothing
}
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-13 15:14:03
UTC (rev 2608)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-03-13 18:20:48
UTC (rev 2609)
@@ -212,6 +212,8 @@
protected abstract boolean callResponseHandlerChain(QName portName, HandlerType
type);
+ protected abstract void closeHandlerChain(QName portName, HandlerType type);
+
protected abstract void setInboundContextProperties();
protected abstract void setOutboundContextProperties();
@@ -335,6 +337,7 @@
handlerPass = handlerPass && callResponseHandlerChain(portName,
HandlerType.ENDPOINT);
handlerPass = handlerPass && callResponseHandlerChain(portName,
HandlerType.PRE);
+ closeHandlerChain(portName, HandlerType.ALL);
// BP-1.0 R1027
if (handlerPass)
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-13
15:14:03 UTC (rev 2608)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/CallImpl.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -555,6 +555,12 @@
return status;
}
+ @Override
+ protected void closeHandlerChain(QName portName, HandlerType type)
+ {
+ // nothing to do for JAXRPC
+ }
+
/** Generate or update the XSD schema for all parameters and the return.
* This should only be done when the Call is unconfigured, hence there is no WSDL
*/
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-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -90,7 +90,7 @@
*/
public HandlerChainBaseImpl(List<HandlerInfo> infos, Set<String> roles)
{
- if(log.isDebugEnabled()) log.debug("Create a handler chain for roles: " +
roles);
+ log.debug("Create a handler chain for roles: " + roles);
addHandlersToChain(infos, roles);
}
@@ -109,8 +109,6 @@
/**
* Initialize the a handler chain with the given handlers infos
- *
- * @throws javax.xml.rpc.JAXRPCException If any error during initialization
*/
private void addHandlersToChain(List<HandlerInfo> infos, Set<String>
roleSet)
{
@@ -159,7 +157,7 @@
*/
public void init(Map config)
{
- if(log.isDebugEnabled()) log.debug("init: [config=" + config +
"]");
+ log.debug("init: [config=" + config + "]");
for (int i = 0; i < handlers.size(); i++)
{
HandlerEntry entry = (HandlerEntry)handlers.get(i);
@@ -177,7 +175,7 @@
*/
public void destroy()
{
- if(log.isDebugEnabled()) log.debug("destroy");
+ log.debug("destroy");
for (int i = 0; i < handlers.size(); i++)
{
HandlerEntry entry = (HandlerEntry)handlers.get(i);
@@ -217,7 +215,7 @@
public void setRoles(String[] soapActorNames)
{
List<String> newRoles = Arrays.asList(soapActorNames);
- if(log.isDebugEnabled()) log.debug("setRoles: " + newRoles);
+ log.debug("setRoles: " + newRoles);
roles.clear();
roles.addAll(newRoles);
@@ -246,7 +244,7 @@
if (handlers.size() > 0)
{
- if(log.isDebugEnabled()) log.debug("Enter: handleRequest");
+ log.debug("Enter: handleRequest");
SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext;
jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
@@ -295,7 +293,7 @@
falseIndex = (handlerIndex - 1);
jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- if(log.isDebugEnabled()) log.debug("Exit: handleRequest with status:
" + doNext);
+ log.debug("Exit: handleRequest with status: " + doNext);
}
}
@@ -328,7 +326,7 @@
if (handlers.size() > 0)
{
- if(log.isDebugEnabled()) log.debug("Enter: handleResponse");
+ log.debug("Enter: handleResponse");
SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext;
jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
@@ -377,7 +375,7 @@
falseIndex = (handlerIndex - 1);
jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- if(log.isDebugEnabled()) log.debug("Exit: handleResponse with status:
" + doNext);
+ log.debug("Exit: handleResponse with status: " + doNext);
}
}
@@ -400,7 +398,7 @@
if (handlers.size() > 0)
{
- if(log.isDebugEnabled()) log.debug("Enter: handleFault");
+ log.debug("Enter: handleFault");
SOAPMessageContextJAXRPC jaxrpcContext = (SOAPMessageContextJAXRPC)msgContext;
jaxrpcContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
@@ -415,14 +413,14 @@
for (; doNext && handlerIndex >= 0; handlerIndex--)
{
currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
- if(log.isDebugEnabled()) log.debug("Handle fault: " +
currHandler);
+ log.debug("Handle fault: " + currHandler);
doNext = currHandler.handleFault(msgContext);
}
}
finally
{
jaxrpcContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- if(log.isDebugEnabled()) log.debug("Exit: handleFault with status:
" + doNext);
+ log.debug("Exit: handleFault with status: " + doNext);
}
}
@@ -465,7 +463,7 @@
HandlerEntry entry = (HandlerEntry)handlers.get(i);
if (entry.handler.getState() == HandlerWrapper.DOES_NOT_EXIST)
{
- if(log.isDebugEnabled()) log.debug("Replacing dirty handler: " +
entry.handler);
+ log.debug("Replacing dirty handler: " + entry.handler);
try
{
HandlerWrapper handler = new
HandlerWrapper((Handler)entry.info.getHandlerClass().newInstance());
@@ -576,7 +574,7 @@
if (type == null)
{
- if(log.isDebugEnabled()) log.debug("Using handler type default: " +
HandlerType.ENDPOINT);
+ log.debug("Using handler type default: " + HandlerType.ENDPOINT);
type = HandlerType.ENDPOINT;
}
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-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -65,6 +65,11 @@
{
}
+ public void closeHandlerChain(ServiceEndpointInfo seInfo)
+ {
+ // nothing to do for JAXRPC
+ }
+
public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
{
SOAPMessageContextJAXRPC msgContext =
(SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
@@ -196,5 +201,4 @@
handlerChain.init(null);
}
}
-
}
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-13
15:14:03 UTC (rev 2608)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -152,6 +152,14 @@
}
@Override
+ protected void closeHandlerChain(QName portName, HandlerType type)
+ {
+ BindingExt binding = (BindingExt)getBindingProvider().getBinding();
+ HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData,
binding.getHandlerChain(type));
+ executor.close();
+ }
+
+ @Override
protected void setInboundContextProperties()
{
// Mark the message context as outbound
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerChainExecutor.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerChainExecutor.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerChainExecutor.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -63,8 +63,8 @@
public HandlerChainExecutor(EndpointMetaData epMetaData, List<Handler>
handlerList)
{
this.epMetaData = epMetaData;
-
- if(log.isDebugEnabled()) log.debug("Create a handler executor: " +
handlerList);
+
+ log.debug("Create a handler executor: " + handlerList);
for (Handler handler : handlerList)
{
handlers.add(handler);
@@ -76,10 +76,12 @@
*/
public void close()
{
- if(log.isDebugEnabled()) log.debug("close");
- for (Handler handler : handlers)
+ log.debug("close");
+ int handlerIndex = handlers.size() - 1;
+ for (; handlerIndex >= 0; handlerIndex--)
{
- handler.close(null);
+ Handler currHandler = handlers.get(handlerIndex);
+ currHandler.close(null);
}
}
@@ -89,7 +91,7 @@
if (handlers.size() > 0)
{
- if(log.isDebugEnabled()) log.debug("Enter: handleRequest");
+ log.debug("Enter: handleRequest");
SOAPMessageContextJAXWS soapContext = (SOAPMessageContextJAXWS)msgContext;
soapContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
@@ -130,7 +132,7 @@
falseIndex = (handlerIndex - 1);
soapContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- if(log.isDebugEnabled()) log.debug("Exit: handleRequest with status:
" + doNext);
+ log.debug("Exit: handleRequest with status: " + doNext);
}
}
@@ -146,7 +148,7 @@
if (handlers.size() > 0)
{
- if(log.isDebugEnabled()) log.debug("Enter: handleResponse");
+ log.debug("Enter: handleResponse");
int handlerIndex = handlers.size() - 1;
if (falseIndex != -1)
@@ -187,7 +189,7 @@
falseIndex = (handlerIndex - 1);
soapContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- if(log.isDebugEnabled()) log.debug("Exit: handleResponse with status:
" + doNext);
+ log.debug("Exit: handleResponse with status: " + doNext);
}
}
@@ -200,7 +202,7 @@
if (handlers.size() > 0)
{
- if(log.isDebugEnabled()) log.debug("Enter: handleFault");
+ log.debug("Enter: handleFault");
SOAPMessageContextJAXWS soapContext = (SOAPMessageContextJAXWS)msgContext;
soapContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
@@ -241,7 +243,7 @@
falseIndex = (handlerIndex - 1);
soapContext.removeProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- if(log.isDebugEnabled()) log.debug("Exit: handleFault with status:
" + doNext);
+ log.debug("Exit: handleFault with status: " + doNext);
}
}
@@ -269,7 +271,7 @@
{
if (epMetaData.getStyle() == Style.RPC)
throw new WebServiceException("Cannot use logical handler with
RPC");
-
+
handlerContext = new LogicalMessageContextImpl(soapContext);
}
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-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -51,7 +51,7 @@
public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
{
- if(log.isDebugEnabled()) log.debug("callRequestHandlerChain: " + type);
+ log.debug("callRequestHandlerChain: " + type);
SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
EndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
@@ -59,6 +59,7 @@
if (epMetaData.isHandlersInitialized() == false)
{
initResolverChain(epMetaData);
+ epMetaData.setHandlersInitialized(true);
}
List<Handler> handlerChain = getHandlerChain(epMetaData, type);
@@ -68,7 +69,7 @@
public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
{
- if(log.isDebugEnabled()) log.debug("callResponseHandlerChain: " + type);
+ log.debug("callResponseHandlerChain: " + type);
SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
List<Handler> handlerChain = getHandlerChain(epMetaData, type);
@@ -76,9 +77,22 @@
return status;
}
+ public void closeHandlerChain(ServiceEndpointInfo seInfo)
+ {
+ log.debug("closeHandlerChain");
+ EndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
+
+ List<Handler> handlerChain = getHandlerChain(epMetaData, HandlerType.POST);
+ new HandlerChainExecutor(epMetaData, handlerChain).close();
+ handlerChain = getHandlerChain(epMetaData, HandlerType.ENDPOINT);
+ new HandlerChainExecutor(epMetaData, handlerChain).close();
+ handlerChain = getHandlerChain(epMetaData, HandlerType.PRE);
+ new HandlerChainExecutor(epMetaData, handlerChain).close();
+ }
+
public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type,
Exception ex)
{
- if(log.isDebugEnabled()) log.debug("callFaultHandlerChain: " + type);
+ log.debug("callFaultHandlerChain: " + type);
SOAPMessageContextJAXWS msgContext =
(SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
List<Handler> handlerChain = getHandlerChain(epMetaData, type);
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -23,6 +23,9 @@
// $Id$
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -30,6 +33,8 @@
import java.util.Map;
import java.util.Set;
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
import javax.xml.namespace.QName;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.HandlerResolver;
@@ -39,6 +44,7 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData;
@@ -74,7 +80,7 @@
public List<Handler> getHandlerChain(PortInfo info, HandlerType type)
{
- if(log.isDebugEnabled()) log.debug("getHandlerChain: [type=" + type +
",info=" + info + "]");
+ log.debug("getHandlerChain: [type=" + type + ",info=" + info +
"]");
List<Handler> unsortedChain = new ArrayList<Handler>();
@@ -89,7 +95,7 @@
List<Handler> list = handlerMap.get(new PortInfoImpl(null, null,
bindingID));
if (list != null)
{
- if(log.isDebugEnabled()) log.debug("add protocol handlers: " +
list);
+ log.debug("add protocol handlers: " + list);
unsortedChain.addAll(list);
}
}
@@ -99,7 +105,7 @@
List<Handler> list = handlerMap.get(new PortInfoImpl(serviceName, null,
null));
if (list != null)
{
- if(log.isDebugEnabled()) log.debug("add service handlers: " +
list);
+ log.debug("add service handlers: " + list);
unsortedChain.addAll(list);
}
}
@@ -109,7 +115,7 @@
List<Handler> list = handlerMap.get(new PortInfoImpl(null, portName,
null));
if (list != null)
{
- if(log.isDebugEnabled()) log.debug("add port handlers: " + list);
+ log.debug("add port handlers: " + list);
unsortedChain.addAll(list);
}
}
@@ -117,7 +123,7 @@
List<Handler> list = handlerMap.get(new PortInfoImpl(null, null, null));
if (list != null)
{
- if(log.isDebugEnabled()) log.debug("add general handlers: " + list);
+ log.debug("add general handlers: " + list);
unsortedChain.addAll(list);
}
@@ -139,10 +145,9 @@
public void initHandlerChain(EndpointMetaData epMetaData, HandlerType type)
{
- if(log.isDebugEnabled()) log.debug("initHandlerChain: " + type);
+ log.debug("initHandlerChain: " + type);
// clear all exisisting handler to avoid double registration
- if(log.isDebugEnabled()) log.debug("Clear handler map: " +
jaxwsHandlers);
Map<PortInfo, List<Handler>> handlerMap = getHandlerMap(type);
handlerMap.clear();
@@ -165,6 +170,12 @@
if (handler instanceof GenericSOAPHandler)
((GenericSOAPHandler)handler).setHeaders(soapHeaders);
+
+ // Inject resources
+ injectResources(handler);
+
+ // Call @PostConstruct
+ callPostConstruct(handler);
List<PortInfo> infos = getPortInfos(epMetaData, jaxwsMetaData);
for (PortInfo info : infos)
@@ -183,6 +194,33 @@
}
}
+ private void injectResources(Handler handler)
+ {
+ Class<? extends Handler> handlerClass = handler.getClass();
+ for (Field field : handlerClass.getFields())
+ {
+ if (field.isAnnotationPresent(Resource.class))
+ throw new NotImplementedException("@Resource not implemented for
handler: " + handlerClass.getName());
+ }
+ for (Method method : handlerClass.getMethods())
+ {
+ if (method.isAnnotationPresent(Resource.class))
+ throw new NotImplementedException("@Resource not implemented for
handler: " + handlerClass.getName());
+ }
+ }
+
+ private void callPostConstruct(Handler handler) throws Exception
+ {
+ Class<? extends Handler> handlerClass = handler.getClass();
+ for (Method method : handlerClass.getMethods())
+ {
+ if (method.isAnnotationPresent(PostConstruct.class))
+ {
+ method.invoke(handler, new Object[]{});
+ }
+ }
+ }
+
private List<PortInfo> getPortInfos(EndpointMetaData epMetaData,
HandlerMetaDataJAXWS handlerMetaData)
{
String protocols = handlerMetaData.getProtocolBindings();
@@ -286,7 +324,7 @@
private boolean addHandler(PortInfo info, Handler handler, HandlerType type)
{
- if(log.isDebugEnabled()) log.debug("addHandler: " + info + ":"
+ handler);
+ log.debug("addHandler: " + info + ":" + handler);
Map<PortInfo, List<Handler>> handlerMap = getHandlerMap(type);
List<Handler> handlerList = handlerMap.get(info);
@@ -308,6 +346,9 @@
handlerMap = jaxwsHandlers;
else if (type == HandlerType.POST)
handlerMap = postHandlers;
+ else
+ throw new IllegalArgumentException("Illegal handler type: " + type);
+
return handlerMap;
}
}
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-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -92,14 +92,13 @@
protected abstract Class loadServiceEndpoint(ServiceEndpointInfo seInfo) throws
ClassNotFoundException;
/** Create the instance of the SEI implementation bean if necessary */
- protected abstract Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object
context, Class seiImplClass) throws IllegalAccessException,
- InstantiationException;
+ protected abstract Object createServiceEndpointInstance(ServiceEndpointInfo seInfo,
Object context, Class seiImplClass) throws Exception;
/** Invoke the instance of the SEI implementation bean */
- protected abstract void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object
seiImpl, EndpointInvocation epInv) throws Exception;
+ protected abstract void invokeServiceEndpointInstance(ServiceEndpointInfo seInfo,
Object seiImpl, EndpointInvocation epInv) throws Exception;
/** Destroy the instance of the SEI implementation bean if necessary */
- protected abstract void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object
seiImpl);
+ protected abstract void destroyServiceEndpointInstance(ServiceEndpointInfo seInfo,
Object seiImpl);
public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
{
@@ -111,6 +110,11 @@
return handlerDelegate.callResponseHandlerChain(seInfo, type);
}
+ public void closeHandlerChain(ServiceEndpointInfo seInfo)
+ {
+ handlerDelegate.closeHandlerChain(seInfo);
+ }
+
public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type,
Exception ex)
{
return handlerDelegate.callFaultHandlerChain(seInfo, type, ex);
@@ -127,7 +131,7 @@
Class seImpl = loadServiceEndpoint(seInfo);
// Create an instance of the endpoint implementation bean
- Object seInstance = createServiceEndpoint(seInfo, context, seImpl);
+ Object seInstance = createServiceEndpointInstance(seInfo, context, seImpl);
try
{
@@ -160,7 +164,8 @@
// Check if protocol handlers modified the payload
if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
{
- if(log.isDebugEnabled()) log.debug("Handler modified body payload,
unbind message again");
+ if (log.isDebugEnabled())
+ log.debug("Handler modified body payload, unbind message
again");
epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
}
@@ -170,7 +175,7 @@
msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM,
Boolean.TRUE);
try
{
- invokeServiceEndpoint(seInfo, seInstance, epInv);
+ invokeServiceEndpointInstance(seInfo, seInstance, epInv);
}
finally
{
@@ -183,8 +188,8 @@
if (epMetaData.getType() == EndpointMetaData.Type.JAXWS)
msgContext.setProperty(MessageContext.MESSAGE_OUTBOUND_PROPERTY,
Boolean.TRUE);
- if(binding instanceof CommonSOAPBinding)
- XOPContext.setMTOMEnabled( ((CommonSOAPBinding)binding).isMTOMEnabled());
+ if (binding instanceof CommonSOAPBinding)
+ XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
// Bind the response message
SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData,
epInv);
@@ -197,6 +202,7 @@
handlersPass = callResponseHandlerChain(seInfo, HandlerType.POST);
handlersPass = handlersPass && callResponseHandlerChain(seInfo,
HandlerType.ENDPOINT);
handlersPass = handlersPass && callResponseHandlerChain(seInfo,
HandlerType.PRE);
+ closeHandlerChain(seInfo);
}
SOAPMessage resMessage = msgContext.getSOAPMessage();
@@ -213,6 +219,7 @@
boolean handlersPass = callFaultHandlerChain(seInfo, HandlerType.POST, ex);
handlersPass = handlersPass && callFaultHandlerChain(seInfo,
HandlerType.ENDPOINT, ex);
handlersPass = handlersPass && callFaultHandlerChain(seInfo,
HandlerType.PRE, ex);
+ closeHandlerChain(seInfo);
}
catch (Exception subEx)
{
@@ -222,13 +229,14 @@
}
finally
{
- destroyServiceEndpoint(seInfo, seInstance);
+ destroyServiceEndpointInstance(seInfo, seInstance);
}
}
protected CommonMessageContext processPivot(CommonMessageContext requestContext)
{
- if(log.isDebugEnabled()) log.debug("Begin response processing");
+ if (log.isDebugEnabled())
+ log.debug("Begin response processing");
// TODO: implement
return requestContext;
}
Modified: 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-13
15:14:03 UTC (rev 2608)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/server/HandlerDelegate.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -25,8 +25,7 @@
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-/** An implementation of handles invocations on the endpoint
- *
+/**
* @author Thomas.Diesler(a)jboss.org
* @since 19-Jan-2005
*/
@@ -37,4 +36,6 @@
public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType
type);
public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type,
Exception ex);
+
+ public void closeHandlerChain(ServiceEndpointInfo seInfo);
}
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -33,8 +33,8 @@
public interface ServiceEndpointInvoker
{
/** Initialize the service endpoint */
- public void initServiceEndpoint(ServiceEndpointInfo seInfo);
+ void initServiceEndpoint(ServiceEndpointInfo seInfo);
/** Invoke the the service endpoint */
- public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object endpointContext) throws
Exception;
+ SOAPMessage invoke(ServiceEndpointInfo seInfo, Object endpointContext) throws
Exception;
}
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -64,7 +64,7 @@
}
/** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpoint(ServiceEndpointInfo seInfo, Object context, Class
seiImplClass) throws IllegalAccessException, InstantiationException
+ public Object createServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
context, Class seiImplClass) throws IllegalAccessException, InstantiationException
{
Object seiImpl = seiImplClass.newInstance();
if (seiImpl instanceof ServiceLifecycle && context != null)
@@ -84,7 +84,7 @@
}
/** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws SOAPFaultException, Exception
+ public void invokeServiceEndpointInstance(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws SOAPFaultException, Exception
{
if(log.isDebugEnabled()) log.debug("invokeServiceEndpoint: " +
epInv.getJavaMethod().getName());
try
@@ -111,7 +111,7 @@
}
/** Destroy an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl)
+ public void destroyServiceEndpointInstance(ServiceEndpointInfo seInfo, Object
seiImpl)
{
if (seiImpl instanceof ServiceLifecycle)
{
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -37,25 +37,52 @@
* Test JAXWS handler lifecycle
*
* @author Thomas.Diesler(a)jboss.org
- * @since 12-Aug-2006
+ * @since 13-MAr-2007
*/
public class HandlerLifecycleTestCase extends JBossWSTest
{
+ private static SOAPEndpoint port;
+
public static Test suite()
{
return JBossWSTestSetup.newTestSetup(HandlerLifecycleTestCase.class,
"jaxws-handlerlifecycle.war");
}
+ public void setUp() throws Exception
+ {
+ if (port == null)
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-handlerlifecycle?wsdl");
+ QName serviceName = new
QName("http://org.jboss.ws/jaxws/handlerlifecycle",
"SOAPEndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ port = (SOAPEndpoint)service.getPort(SOAPEndpoint.class);
+ }
+ }
+
public void testClientAccess() throws Exception
{
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-handlerlifecycle?wsdl");
- QName serviceName = new
QName("http://org.jboss.ws/jaxws/handlerlifecycle",
"SOAPEndpointService");
- Service service = Service.create(wsdlURL, serviceName);
- SOAPEndpoint port = (SOAPEndpoint)service.getPort(SOAPEndpoint.class);
-
String retStr = port.echo("hello");
-
- StringBuffer expStr = new
StringBuffer("hello:ServerHandler:endpoint:ServerHandler");
+ StringBuffer expStr = new
StringBuffer("hello:InBound:ServerHandler:endpoint:OutBound:ServerHandler");
assertEquals(expStr.toString(), retStr);
}
+
+ public void testPostConstruct() throws Exception
+ {
+ String retStr = port.getPostConstruct();
+ assertEquals("PostConstruct:ServerHandler", retStr);
+ }
+
+ /* Not Implemented
+ public void testPreDestroy() throws Exception
+ {
+ String retStr = port.getPreDestroy();
+ assertEquals("PreDestroy:ServerHandler", retStr);
+ }
+ */
+
+ public void testClose() throws Exception
+ {
+ String retStr = port.getClose();
+ assertEquals("Close:ServerHandler", retStr);
+ }
}
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxws.handlerlifecycle;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
@@ -28,34 +30,68 @@
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPMessageContext;
+import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
public class LifecycleHandler extends GenericSOAPHandler
{
+ private static Logger log = Logger.getLogger(LifecycleHandler.class);
+
+ static String postConstructMsg;
+ static String preDestroyMsg;
+ static String closeMsg;
+
+ public LifecycleHandler()
+ {
+ log.info("new LifecycleHandler");
+ }
+
@Override
public boolean handleOutbound(MessageContext msgContext)
{
- return appendHandlerName(msgContext);
+ log.info("handleOutbound: " + this);
+ return appendHandlerName(msgContext, "OutBound:" + getHandlerName());
}
-
+
@Override
public boolean handleInbound(MessageContext msgContext)
{
- return appendHandlerName(msgContext);
+ log.info("handleInbound: " + this);
+ return appendHandlerName(msgContext, "InBound:" + getHandlerName());
}
- private boolean appendHandlerName(MessageContext msgContext)
+ @PostConstruct
+ public void postConstruct()
{
+ log.info("postConstruct: " + this);
+ postConstructMsg = "PostConstruct:" + getHandlerName();
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ log.info("preDestroy: " + this);
+ preDestroyMsg = "PreDestroy:" + getHandlerName();
+ }
+
+ public void close(MessageContext messageContext)
+ {
+ log.info("close: " + this);
+ closeMsg = "Close:" + getHandlerName();
+ }
+
+ private boolean appendHandlerName(MessageContext msgContext, String handlerMsg)
+ {
try
{
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
SOAPElement soapElement =
(SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
- soapElement = (SOAPElement)soapElement.getChildElements().next();
- String value = soapElement.getValue();
-
- String handlerName = getHandlerName();
- soapElement.setValue(value + ":" + handlerName);
-
+ if (soapElement.getElementQName().getLocalPart().startsWith("echo"))
+ {
+ soapElement = (SOAPElement)soapElement.getChildElements().next();
+ String value = soapElement.getValue();
+ soapElement.setValue(value + ":" + handlerMsg);
+ }
return true;
}
catch (SOAPException ex)
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -31,4 +31,13 @@
{
@WebMethod
public String echo(String msg);
+
+ @WebMethod
+ public String getPostConstruct();
+
+ @WebMethod
+ public String getPreDestroy();
+
+ @WebMethod
+ public String getClose();
}
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.java 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.java 2007-03-13
18:20:48 UTC (rev 2609)
@@ -44,4 +44,25 @@
log.info("echo: " + msg);
return msg + ":endpoint";
}
+
+ @WebMethod
+ public String getPostConstruct()
+ {
+ log.info("getPostConstruct: " + LifecycleHandler.postConstructMsg);
+ return LifecycleHandler.postConstructMsg;
+ }
+
+ @WebMethod
+ public String getPreDestroy()
+ {
+ log.info("getPreDestroy: " + LifecycleHandler.preDestroyMsg);
+ return LifecycleHandler.postConstructMsg;
+ }
+
+ @WebMethod
+ public String getClose()
+ {
+ log.info("getClose: " + LifecycleHandler.closeMsg);
+ return LifecycleHandler.closeMsg;
+ }
}
Copied:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/handlerchain/jaxws-handlers.xml
(from rev 2607,
trunk/jbossws-tests/src/resources/jaxws/samples/handlerchain/jaxws-handlers.xml)
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/handlerchain/jaxws-handlers.xml
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/handlerchain/jaxws-handlers.xml 2007-03-13
18:20:48 UTC (rev 2609)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<handler-chains
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+ <handler>
+ <handler-name> LogHandler </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.samples.handlerchain.LogHandler
</handler-class>
+ <init-param>
+ <param-name>logCategory</param-name>
+ <param-value>MyService</param-value>
+ </init-param>
+ </handler>
+ <handler>
+ <handler-name> AuthorizationHandler </handler-name>
+ <handler-class>
org.jboss.test.ws.jaxws.samples.handlerchain.AuthorizationHandler </handler-class>
+ <soap-role>SecurityProvider</soap-role>
+ </handler>
+ <handler>
+ <handler-name> RoutingHandler </handler-name>
+ <handler-class>
org.jboss.test.ws.jaxws.samples.handlerchain.RoutingHandler </handler-class>
+ </handler>
+ </handler-chain>
+</handler-chains>
\ No newline at end of file
Deleted: trunk/jbossws-tests/src/resources/jaxws/samples/handlerchain/jaxws-handlers.xml
===================================================================
---
trunk/jbossws-tests/src/resources/jaxws/samples/handlerchain/jaxws-handlers.xml 2007-03-13
15:14:03 UTC (rev 2608)
+++
trunk/jbossws-tests/src/resources/jaxws/samples/handlerchain/jaxws-handlers.xml 2007-03-13
18:20:48 UTC (rev 2609)
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<handler-chains
xmlns="http://java.sun.com/xml/ns/javaee"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
javaee_web_services_1_2.xsd">
-
- <handler-chain>
- <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
- <handler>
- <handler-name> LogHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.samples.handlerchain.LogHandler
</handler-class>
- <init-param>
- <param-name>logCategory</param-name>
- <param-value>MyService</param-value>
- </init-param>
- </handler>
- <handler>
- <handler-name> AuthorizationHandler </handler-name>
- <handler-class>
org.jboss.test.ws.jaxws.samples.handlerchain.AuthorizationHandler </handler-class>
- <soap-role>SecurityProvider</soap-role>
- </handler>
- <handler>
- <handler-name> RoutingHandler </handler-name>
- <handler-class>
org.jboss.test.ws.jaxws.samples.handlerchain.RoutingHandler </handler-class>
- </handler>
- </handler-chain>
-</handler-chains>
\ No newline at end of file