You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ga...@apache.org on 2004/11/17 18:08:18 UTC
cvs commit: ws-fx/addressing/src/org/apache/axis/message/addressing/util TextExtractor.java
gawor 2004/11/17 09:08:17
Modified: addressing/src/org/apache/axis/message/addressing/handler
AddressingHandler.java
addressing/src/org/apache/axis/message/addressing/util
TextExtractor.java
Log:
some performance related updates
Revision Changes Path
1.28 +38 -9 ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AddressingHandler.java
Index: AddressingHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/handler/AddressingHandler.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- AddressingHandler.java 8 Nov 2004 18:26:21 -0000 1.27
+++ AddressingHandler.java 17 Nov 2004 17:08:17 -0000 1.28
@@ -22,6 +22,10 @@
import org.apache.axis.MessageContext;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.axis.message.RPCElement;
+import org.apache.axis.description.OperationDesc;
import org.apache.axis.components.uuid.UUIDGen;
import org.apache.axis.components.uuid.UUIDGenFactory;
import org.apache.axis.handlers.BasicHandler;
@@ -54,7 +58,8 @@
protected static Log log =
LogFactory.getLog(AddressingHandler.class.getName());
- private UUIDGen uuidGen;
+ // let's reuse uuid generator
+ private static UUIDGen uuidGen = UUIDGenFactory.getUUIDGen();
// A list of QNames of reference properties specified by the
// deployer that need to be handled.
@@ -66,9 +71,7 @@
private boolean removeHeaders = false;
- public AddressingHandler() {
- uuidGen = UUIDGenFactory.getUUIDGen();
- }
+ public AddressingHandler() {}
/**
* Initialize the addressing handler.
@@ -340,15 +343,41 @@
msgContext.getTargetService() == null) {
setTargetService(msgContext, headers);
- // This is to ensure the SOAPEnvelope is rebuild
- // with right type mappings and
- // MessageContext is set with right properties.
- if (msgContext.getTargetService() != null) {
- msg.getSOAPPartAsString();
+ if (msgContext.getService() != null) {
+ resetOperations(msgContext);
}
}
}
+ // Reinitializes the RPCElement with right operations
+ // so that things are nicely deserialized
+ public static void resetOperations(MessageContext msgContext)
+ throws AxisFault {
+ Message msg = msgContext.getCurrentMessage();
+ if (msg == null) {
+ return;
+ }
+ SOAPEnvelope env = msg.getSOAPEnvelope();
+ if (env == null) {
+ return;
+ }
+ SOAPBodyElement bodyElement = env.getFirstBody();
+ if (bodyElement != null && bodyElement instanceof RPCElement) {
+ RPCElement element = (RPCElement)bodyElement;
+ // update the operations in RPCElement
+ element.updateOperationsByQName();
+ OperationDesc [] operations = element.getOperations();
+ // and set operation if appropriate
+ if (operations == null) {
+ element.updateOperationsByName();
+ } else if (operations.length == 1) {
+ msgContext.setOperation(operations[0]);
+ }
+ } else {
+ msg.getSOAPPartAsString();
+ }
+ }
+
/**
* Can be overridden by subclasses to customize
* how the wsa:to header is interpreted
1.5 +2 -5 ws-fx/addressing/src/org/apache/axis/message/addressing/util/TextExtractor.java
Index: TextExtractor.java
===================================================================
RCS file: /home/cvs/ws-fx/addressing/src/org/apache/axis/message/addressing/util/TextExtractor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TextExtractor.java 18 Jun 2004 20:39:45 -0000 1.4
+++ TextExtractor.java 17 Nov 2004 17:08:17 -0000 1.5
@@ -63,11 +63,8 @@
public static String getText(SOAPElement element)
throws Exception {
- // XXX: must convert to DOM explicitely
- // becuase when MessageElement is created from DOM
- // element, the SOAPElement.getChildElements() will always return 0
- Element node = toDOM(element);
- return getText(node);
+ String value = element.getValue();
+ return (value == null) ? "" : value.trim();
}
// Not a best place for it