You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2007/03/30 07:08:47 UTC
svn commit: r523941 - in
/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws:
handler/HandlerChainProcessor.java handler/HandlerInvokerUtils.java
server/EndpointController.java
Author: dims
Date: Thu Mar 29 22:08:46 2007
New Revision: 523941
URL: http://svn.apache.org/viewvc?view=rev&rev=523941
Log:
We read handler chains from webservices.xml and set up a BindingImpl in Axis2/Geronimo integration. That information is eventually set in the invocationcontext. So, If there are handlers specified in the invocationcontext, then use them.
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java?view=diff&rev=523941&r1=523940&r2=523941
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java Thu Mar 29 22:08:46 2007
@@ -25,6 +25,7 @@
import org.apache.axis2.jaxws.message.XMLFault;
import org.apache.axis2.jaxws.message.util.XMLFaultUtils;
import org.apache.axis2.jaxws.utility.SAAJFactory;
+import java.util.List;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConstants;
@@ -44,19 +45,15 @@
public enum Direction {
IN, OUT
- }
-
- ;
+ };
// the type of message, not indicative of one-way vs. request-response
public enum MEP {
REQUEST, RESPONSE
- }
-
- ;
+ };
private MessageContext mc;
- private ArrayList<Handler> handlers = null;
+ private List<Handler> handlers = null;
// track start/end of logical and protocol handlers in the list
// The two scenarios are: 1) run logical handlers only, 2) run all handlers
@@ -79,7 +76,7 @@
* it may not be sorted. The processChain and processFault methods check
* for this by calling verifyChain.
*/
- public HandlerChainProcessor(ArrayList<Handler> chain) {
+ public HandlerChainProcessor(List<Handler> chain) {
if (chain == null) {
handlers = new ArrayList<Handler>();
} else
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java?view=diff&rev=523941&r1=523940&r2=523941
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerInvokerUtils.java Thu Mar 29 22:08:46 2007
@@ -23,6 +23,7 @@
import org.apache.axis2.jaxws.context.factory.MessageContextFactory;
import org.apache.axis2.jaxws.context.utils.ContextUtils;
import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.core.InvocationContext;
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.message.Message;
import org.apache.axis2.jaxws.message.factory.MessageFactory;
@@ -34,20 +35,24 @@
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.soap.SOAPMessageContext;
import java.util.ArrayList;
+import java.util.List;
public class HandlerInvokerUtils {
/**
* Invoke Inbound Handlers
*
- * @param requestMsgCtx
+ * @param msgCtx
*/
public static boolean invokeInboundHandlers(MessageContext msgCtx,
EndpointDescription endpointDesc,
HandlerChainProcessor.MEP mep, boolean isOneWay) {
- HandlerResolverImpl hResolver = new HandlerResolverImpl(endpointDesc);
- ArrayList<Handler> handlers = hResolver.getHandlerChain(endpointDesc.getPortInfo());
+ List<Handler> handlers = msgCtx.getInvocationContext().getHandlers();
+ if(handlers == null) {
+ HandlerResolverImpl hResolver = new HandlerResolverImpl(endpointDesc);
+ handlers = hResolver.getHandlerChain(endpointDesc.getPortInfo());
+ }
int numHandlers = handlers.size();
@@ -113,8 +118,15 @@
// TODO you may need to hard-code add some handlers until we
// actually have useful code under EndpointDescription.getHandlerList()
- HandlerResolverImpl hResolver = new HandlerResolverImpl(endpointDesc);
- ArrayList<Handler> handlers = hResolver.getHandlerChain(endpointDesc.getPortInfo());
+ List<Handler> handlers = null;
+ InvocationContext ic = msgCtx.getInvocationContext();
+ if(ic != null) {
+ handlers = ic.getHandlers();
+ }
+ if(handlers == null) {
+ HandlerResolverImpl hResolver = new HandlerResolverImpl(endpointDesc);
+ handlers = hResolver.getHandlerChain(endpointDesc.getPortInfo());
+ }
int numHandlers = handlers.size();
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java?view=diff&rev=523941&r1=523940&r2=523941
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java Thu Mar 29 22:08:46 2007
@@ -154,6 +154,9 @@
requestMsgCtx.getMessage().setPostPivot();
}
+ // The response MessageContext should be set on the InvocationContext
+ ic.setResponseMessageContext(responseMsgContext);
+
// Invoke outbound application handlers. It's safe to use the first object on the iterator because there is
// always exactly one EndpointDescription on a server invoke
HandlerInvokerUtils.invokeOutboundHandlers(responseMsgContext,
@@ -166,6 +169,9 @@
MessageContextUtils.createResponseMessageContext(requestMsgCtx);
// since we've reversed directions, the message has "become a response message" (section 9.3.2.1, footnote superscript 2)
responseMsgContext.setMessage(requestMsgCtx.getMessage());
+
+ // The response MessageContext should be set on the InvocationContext
+ ic.setResponseMessageContext(responseMsgContext);
}
} catch (Exception e) {
@@ -174,9 +180,6 @@
} finally {
restoreRequestMessage(requestMsgCtx);
}
-
- // The response MessageContext should be set on the InvocationContext
- ic.setResponseMessageContext(responseMsgContext);
return ic;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org