Author: scheu Date: Tue Dec 7 02:09:47 2010 New Revision: 1042889 URL: http://svn.apache.org/viewvc?rev=1042889&view=rev Log: AXIS2-4906 Contributor:Doug Larson & Rich Scheuerle Summary: Small, localized refactoring to remove unnecessary getProperty calls.
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/AttachmentsAdapter.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java?rev=1042889&r1=1042888&r2=1042889&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java Tue Dec 7 02:09:47 2010 @@ -179,6 +179,17 @@ public class MessageContext { axisMsgCtx.setProperty(key, value); return retval; } + + /** + * Like getProperty, but does not return prior value. + * This method should be used in scenarios where + * the prior value is not needed. + * @param key String + * @param value Object + */ + public void setPropertyNoReturn(String key, Object value) { + axisMsgCtx.setProperty(key, value); + } public EndpointDescription getEndpointDescription() { return endpointDesc; Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/AttachmentsAdapter.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/AttachmentsAdapter.java?rev=1042889&r1=1042888&r2=1042889&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/AttachmentsAdapter.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/AttachmentsAdapter.java Tue Dec 7 02:09:47 2010 @@ -108,7 +108,7 @@ public class AttachmentsAdapter implemen // Copy the existing Map contents to this new adapter aa.putAll((Map<String, DataHandler>) map); } - mc.setProperty(propertyName, aa); + mc.setPropertyNoReturn(propertyName, aa); } Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java?rev=1042889&r1=1042888&r2=1042889&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java Tue Dec 7 02:09:47 2010 @@ -107,7 +107,7 @@ public class SOAPHeadersAdapter implemen // Copy the existing Map contents to this new adapter sha.putAll((Map<QName, List<String>>) map); } - mc.setProperty(property, sha); + mc.setPropertyNoReturn(property, sha); } /** Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java?rev=1042889&r1=1042888&r2=1042889&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/handler/TransportHeadersAdapter.java Tue Dec 7 02:09:47 2010 @@ -106,7 +106,7 @@ public class TransportHeadersAdapter imp // Copy the existing Map contents to this new adapter tha.putAll((Map) map); } - mc.setProperty(propertyName, tha); + mc.setPropertyNoReturn(propertyName, tha); // If this is a response, then also set the property for the response code if (!isRequest) { Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?rev=1042889&r1=1042888&r2=1042889&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java Tue Dec 7 02:09:47 2010 @@ -489,13 +489,14 @@ public class TransportUtils { try { // If this is the request MessageContext we should find it directly by the getProperty() // method - if (messageContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL) - != null) { - return (RequestResponseTransport) messageContext.getProperty( - RequestResponseTransport.TRANSPORT_CONTROL); + RequestResponseTransport transportControl = (RequestResponseTransport) + messageContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL); + + if (transportControl != null) { + return transportControl; } - // If this is the response MessageContext we need to look for the request MessageContext - else if (messageContext.getOperationContext() != null + // If this is the response MessageContext we need to look for the request MessageContext + else if (messageContext.getOperationContext() != null && messageContext.getOperationContext() .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE) != null) { return (RequestResponseTransport) messageContext.