axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r537322 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/ kernel/src/org/apache/axis2/context/ kernel/src/org/apache/axis2/transport/ kernel/src/org/apache/axis2/transport/http/ kernel/src/org/...
Date Sat, 12 May 2007 01:28:41 GMT
Author: gdaniels
Date: Fri May 11 18:28:40 2007
New Revision: 537322

URL: http://svn.apache.org/viewvc?view=rev&rev=537322
Log:
* Add MessageContext.isPropertyTrue() method, to avoid people needing to use other classes,
do their own null checks, etc.  Deprecate Utils.isExplicitlyTrue(). Refactor a bunch of stuff
to use the new method.

* Clean up / improve JavaDoc in various places

* Remove unused namespace args from methods in AddressingInHandler

* Fix some potential NPEs in CommonsHTTPTransportSender

* Comment unused code in HTTPSender

Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisRequestEntity.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPSender.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?view=diff&rev=537322&r1=537321&r2=537322
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Fri May 11 18:28:40 2007
@@ -29,7 +29,6 @@
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.LoggingControl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -47,7 +46,7 @@
 
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
         // if another handler has already processed the addressing headers, do not do anything
here.
-        if (JavaUtils.isTrueExplicitly(msgContext.getProperty(IS_ADDR_INFO_ALREADY_PROCESSED)))
{
+        if (msgContext.isPropertyTrue(IS_ADDR_INFO_ALREADY_PROCESSED)) {
             if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                 log.debug(
                         "Another handler has processed the addressing headers. Nothing to
do here.");
@@ -154,19 +153,19 @@
             SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock)addressingHeadersIt2.next();
             if (!SOAP12Constants.SOAP_ROLE_NONE.equals(soapHeaderBlock.getRole())) {
                 if (WSA_ACTION.equals(soapHeaderBlock.getLocalName()) && !ignoreAction)
{
-                    extractActionInformation(soapHeaderBlock, namespace, messageContext);
+                    extractActionInformation(soapHeaderBlock, messageContext);
                 } else if (WSA_TO.equals(soapHeaderBlock.getLocalName()) && !ignoreTo)
{
                     extractToEPRInformation(soapHeaderBlock, messageContextOptions, header,
                                             namespace);
                 } else
                 if (WSA_MESSAGE_ID.equals(soapHeaderBlock.getLocalName()) && !ignoreMessageID)
{
-                    extractMessageIDInformation(soapHeaderBlock, namespace, messageContext);
+                    extractMessageIDInformation(soapHeaderBlock, messageContext);
                 } else if (WSA_REPLY_TO.equals(soapHeaderBlock.getLocalName()) &&
!ignoreReplyTo) {
                     extractReplyToEPRInformation(soapHeaderBlock, namespace, messageContext);
                 } else if (WSA_FAULT_TO.equals(soapHeaderBlock.getLocalName()) &&
!ignoreFaultTo) {
                     extractFaultToEPRInformation(soapHeaderBlock, namespace, messageContext);
                 } else if (WSA_RELATES_TO.equals(soapHeaderBlock.getLocalName())) {
-                    extractRelatesToInformation(soapHeaderBlock, namespace, messageContextOptions);
+                    extractRelatesToInformation(soapHeaderBlock, messageContextOptions);
                 } else if (WSA_FROM.equals(soapHeaderBlock.getLocalName()) && !ignoreFrom)
{
                     extractFromEPRInformation(soapHeaderBlock, namespace, messageContext);
                 }
@@ -223,7 +222,6 @@
 
 
     private void extractRelatesToInformation(SOAPHeaderBlock soapHeaderBlock,
-                                             String addressingNamespace,
                                              Options messageContextOptions) {
         String address = soapHeaderBlock.getText();
 
@@ -334,7 +332,7 @@
     //soapaction. We compare that action to the WS-Addressing action, and if they are
     //different we throw a fault.
     private void extractActionInformation(SOAPHeaderBlock soapHeaderBlock,
-                                          String addressingNamespace, MessageContext messageContext)
+                                          MessageContext messageContext)
             throws AxisFault {
         Options messageContextOptions = messageContext.getOptions();
         String soapAction = messageContextOptions.getAction();
@@ -373,7 +371,6 @@
     }
 
     private void extractMessageIDInformation(SOAPHeaderBlock soapHeaderBlock,
-                                             String addressingNamespace,
                                              MessageContext messageContext) throws AxisFault
{
         messageContext.getOptions().setMessageId(soapHeaderBlock.getText());
 
@@ -388,9 +385,11 @@
     /**
      * Given the soap header block, this should extract the information within EPR.
      *
-     * @param headerBlock
-     * @param epr
-     * @param addressingNamespace
+     * @param headerBlock a SOAP header which is of type EndpointReference
+     * @param epr the EndpointReference to fill in with the extracted data
+     * @param addressingNamespace the WSA namespace URI
+     * @param messageContext the active MessageContext
+     * @throws AxisFault if there is a problem
      */
     private void extractEPRInformation(SOAPHeaderBlock headerBlock, EndpointReference epr,
                                        String addressingNamespace, MessageContext messageContext)

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?view=diff&rev=537322&r1=537321&r2=537322
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
Fri May 11 18:28:40 2007
@@ -69,7 +69,7 @@
 
     public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
         // it should be able to disable addressing by some one.
-        if (Utils.isExplicitlyTrue(msgContext, DISABLE_ADDRESSING_FOR_OUT_MESSAGES)) {
+        if (msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES)) {
             if (log.isTraceEnabled()) {
                 log.trace(msgContext.getLogIDString() +
                         " Addressing is disabled. Not adding WS-Addressing headers.");
@@ -87,21 +87,18 @@
                 Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt);
 
         // Determine whether to include optional addressing headers in the output.
-        boolean includeOptionalHeaders = this.includeOptionalHeaders;
-        Object includeHeadersPropery = msgContext.getProperty(INCLUDE_OPTIONAL_HEADERS);
-        if (includeHeadersPropery != null) {
-            includeOptionalHeaders = JavaUtils.isTrueExplicitly(includeHeadersPropery);
-        }
+        boolean includeOptionalHeaders = this.includeOptionalHeaders ||
+                                            msgContext.isPropertyTrue(INCLUDE_OPTIONAL_HEADERS);
 
         // Determine if a MustUnderstand attribute will be added to all headers in the
         // addressing namespace.
         boolean addMustUnderstandAttribute =
-                Utils.isExplicitlyTrue(msgContext, ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS);
+                msgContext.isPropertyTrue(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS);
 
         // what if there are addressing headers already in the message. Do you replace that
or not?
         // Lets have a parameter to control that. The default behavior is you won't replace
addressing
         // headers if there are any (this was the case so far).
-        boolean replaceHeaders = Utils.isExplicitlyTrue(msgContext, REPLACE_ADDRESSING_HEADERS);
+        boolean replaceHeaders = msgContext.isPropertyTrue(REPLACE_ADDRESSING_HEADERS);
 
         WSAHeaderWriter writer = new WSAHeaderWriter(msgContext, isSubmissionNamespace,
                                                      addMustUnderstandAttribute, replaceHeaders,
@@ -251,8 +248,8 @@
                                 " processWSAAction: No action to add to header");
                     }
                     // Fault unless validation has been explictily turned off
-                    if (!Utils.isExplicitlyTrue(messageContext,
-                                                AddressingConstants.DISABLE_OUTBOUND_ADDRESSING_VALIDATION))
+                    if (!messageContext.isPropertyTrue(
+                            AddressingConstants.DISABLE_OUTBOUND_ADDRESSING_VALIDATION))
                     {
                         throw new AxisFault(AddressingMessages.getMessage("outboundNoAction"));
                     }
@@ -457,7 +454,7 @@
         /**
          * This will add reference parameters and/or reference properties in to the message
          *
-         * @param referenceInformation
+         * @param referenceInformation a Map from QName -> OMElement
          * @param parent               is the element to which the referenceparameters should
be
          *                             attached
          */

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java?view=diff&rev=537322&r1=537321&r2=537322
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
Fri May 11 18:28:40 2007
@@ -18,7 +18,6 @@
 
 import org.apache.axiom.attachments.Attachments;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.impl.MTOMConstants;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.axiom.om.util.StAXUtils;
@@ -49,6 +48,7 @@
 import org.apache.axis2.util.MetaDataEntry;
 import org.apache.axis2.util.ObjectStateUtils;
 import org.apache.axis2.util.SelfManagedDataHolder;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.neethi.Policy;
@@ -949,6 +949,29 @@
         return null;
     }
 
+    /**
+     * Check if a given property is true.  Will return false if the property
+     * does not exist or is not an explicit "true" value.
+     *
+     * @param name name of the property to check
+     * @return true if the property exists and is Boolean.TRUE, "true", 1, etc.
+     */
+    public boolean isPropertyTrue(String name) {
+        return isPropertyTrue(name, false);
+    }
+
+    /**
+     * Check if a given property is true.  Will return the passed default if the property
+     * does not exist.
+     *
+     * @param name name of the property to check
+     * @param defaultVal the default value if the property doesn't exist
+     * @return true if the property exists and is Boolean.TRUE, "true", 1, etc.
+     */
+    public boolean isPropertyTrue(String name, boolean defaultVal) {
+        return JavaUtils.isTrueExplicitly(getProperty(name), defaultVal);
+    }
+    
     /**
      * Retrieves all property values. The order of search is as follows: search in
      * my own options and then look in my context hierarchy. Since its possible

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?view=diff&rev=537322&r1=537321&r2=537322
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
Fri May 11 18:28:40 2007
@@ -114,8 +114,8 @@
                     if (msgContext.getSoapAction() == null) {
                         type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
                     }
-                } else if (msgContext.isDoingREST() && !JavaUtils.isTrueExplicitly(
-                        msgContext.getProperty(Constants.Configuration.SOAP_RESPONSE_MEP)))
{
+                } else if (msgContext.isDoingREST() &&
+                        !msgContext.isPropertyTrue(Constants.Configuration.SOAP_RESPONSE_MEP))
{
                     type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
                 }
             }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?view=diff&rev=537322&r1=537321&r2=537322
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
Fri May 11 18:28:40 2007
@@ -102,11 +102,13 @@
     }
 
     /**
-     * Helper method to Proxy and NTLM authentication
+     * Helper method for Proxy and NTLM authentication
      *
-     * @param client
-     * @param proxySetting
-     * @param config
+     * @param client HttpClient in which to place proxy config
+     * @param proxySetting TransportOutDescription
+     * @param config HostConfiguraiton in which to place proxy config
+     * @param msgCtx the active MessageContext
+     * @throws AxisFault in case of problems
      */
     protected void configProxyAuthentication(HttpClient client,
                                              TransportOutDescription proxySetting,
@@ -204,8 +206,9 @@
     /**
      * Collect the HTTP header information and set them in the message context
      *
-     * @param method
-     * @param msgContext
+     * @param method HttpMethodBase from which to get information
+     * @param msgContext the MessageContext in which to place the information... OR NOT!
+     * @throws AxisFault if problems occur
      */
     protected void obtainHTTPHeaderInformation(HttpMethodBase method,
                                                MessageContext msgContext) throws AxisFault
{
@@ -236,13 +239,15 @@
                         .setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
             } else {
 
-                //Transport details will be stored in a HashMap so that anybody interested
can retriece them
+                // Transport details will be stored in a HashMap so that anybody interested
can
+                // retrieve them
                 HashMap transportInfoMap = new HashMap();
                 transportInfoMap.put(Constants.Configuration.CONTENT_TYPE, contentType);
                 transportInfoMap.put(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
 
                 //the HashMap is stored in the outgoing message.
-                msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP, transportInfoMap);
+                msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP,
+                                       transportInfoMap);
             }
         }
 
@@ -305,10 +310,16 @@
     }
 
     public abstract void send(MessageContext msgContext, URL url, String soapActionString)
-            throws AxisFault, IOException;
+            throws IOException;
 
     /**
      * getting host configuration to support standard http/s, proxy and NTLM support
+     *
+     * @param client active HttpClient
+     * @param msgCtx active MessageContext
+     * @param targetURL the target URL
+     * @return a HostConfiguration set up with proxy information
+     * @throws AxisFault if problems occur
      */
     protected HostConfiguration getHostConfiguration(HttpClient client,
                                                      MessageContext msgCtx,
@@ -334,7 +345,8 @@
         HostConfiguration config = new HostConfiguration();
 
         // one might need to set his own socket factory. Let's allow that case as well.
-        Protocol protocolHandler = (Protocol) msgCtx.getOptions().getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER);
+        Protocol protocolHandler =
+                (Protocol)msgCtx.getOptions().getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER);
 
         // setting the real host configuration
         // I assume the 90% case, or even 99% case will be no protocol handler case. 
@@ -442,9 +454,9 @@
     /**
      * This is used to get the dynamically set time out values from the
      * message context. If the values are not available or invalid then
-     * teh default values or the values set by teh configuration will be used
+     * the default values or the values set by the configuration will be used
      *
-     * @param msgContext
+     * @param msgContext the active MessageContext
      */
     protected void getTimeoutValues(MessageContext msgContext) {
         try {
@@ -555,12 +567,12 @@
         addCustomHeaders(method, msgContext);
 
         // add compression headers if needed
-        if (Utils.isExplicitlyTrue(msgContext, HTTPConstants.MC_ACCEPT_GZIP)) {
+        if (msgContext.isPropertyTrue(HTTPConstants.MC_ACCEPT_GZIP)) {
             method.addRequestHeader(HTTPConstants.HEADER_ACCEPT_ENCODING,
                     HTTPConstants.COMPRESSION_GZIP);
         }
 
-        if (Utils.isExplicitlyTrue(msgContext, HTTPConstants.MC_GZIP_REQUEST)) {
+        if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) {
             method.addRequestHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
                     HTTPConstants.COMPRESSION_GZIP);
         }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisRequestEntity.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisRequestEntity.java?view=diff&rev=537322&r1=537321&r2=537322
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisRequestEntity.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisRequestEntity.java
Fri May 11 18:28:40 2007
@@ -74,8 +74,7 @@
     }
 
     public void writeRequest(OutputStream outStream) throws IOException {
-        Object gzip = messageContext.getOptions().getProperty(
-                HTTPConstants.MC_GZIP_REQUEST);
+        Object gzip = messageContext.getOptions().getProperty(HTTPConstants.MC_GZIP_REQUEST);
         if (gzip != null && JavaUtils.isTrueExplicitly(gzip) && chunked)
{
             outStream = new GZIPOutputStream(outStream);
         }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=537322&r1=537321&r2=537322
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
Fri May 11 18:28:40 2007
@@ -36,7 +36,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.namespace.QName;
 import javax.xml.stream.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
 import java.io.IOException;
@@ -50,7 +49,6 @@
 public class CommonsHTTPTransportSender extends AbstractHandler implements
         TransportSender {
 
-
     protected static final String PROXY_HOST_NAME = "proxy_host";
 
     protected static final String PROXY_PORT = "proxy_port";
@@ -240,8 +238,10 @@
         OutTransportInfo transportInfo = (OutTransportInfo) msgContext
                 .getProperty(Constants.OUT_TRANSPORT_INFO);
 
+        if (transportInfo == null) throw new AxisFault("No transport info in MessageContext");
+
         ServletBasedOutTransportInfo servletBasedOutTransportInfo = null;
-        if (transportInfo != null && transportInfo instanceof ServletBasedOutTransportInfo)
{
+        if (transportInfo instanceof ServletBasedOutTransportInfo) {
             servletBasedOutTransportInfo =
                     (ServletBasedOutTransportInfo) transportInfo;
             List customHheaders = (List) msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
@@ -259,15 +259,17 @@
 
         format.setAutoCloseWriter(true);
 
-        MessageFormatter messageFormatter = TransportUtils
-                .getMessageFormatter(msgContext);
+        MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(msgContext);
+        if (messageFormatter == null) throw new AxisFault("No MessageFormatter in MessageContext");
+
         transportInfo.setContentType(
                 messageFormatter.getContentType(msgContext, format, findSOAPAction(msgContext)));
 
         Object gzip = msgContext.getOptions().getProperty(HTTPConstants.MC_GZIP_RESPONSE);
         if (gzip != null && JavaUtils.isTrueExplicitly(gzip)) {
-            servletBasedOutTransportInfo.addHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
-                                                   HTTPConstants.COMPRESSION_GZIP);
+            if (servletBasedOutTransportInfo != null)
+                servletBasedOutTransportInfo.addHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
+                                                       HTTPConstants.COMPRESSION_GZIP);
             try {
                 out = new GZIPOutputStream(out);
                 out.write(messageFormatter.getBytes(msgContext, format));

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPSender.java?view=diff&rev=537322&r1=537321&r2=537322
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPSender.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPSender.java
Fri May 11 18:28:40 2007
@@ -17,23 +17,18 @@
 package org.apache.axis2.transport.http;
 
 
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.transport.TransportUtils;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.HttpMethodBase;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.HttpVersion;
-import org.apache.commons.httpclient.URI;
-import org.apache.commons.httpclient.URIException;
-import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.methods.DeleteMethod;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
@@ -42,7 +37,6 @@
 import org.apache.commons.logging.LogFactory;
 
 import java.io.IOException;
-import java.net.MalformedURLException;
 import java.net.URL;
 
 public class HTTPSender extends AbstractHTTPSender {
@@ -50,7 +44,7 @@
     private static final Log log = LogFactory.getLog(HTTPSender.class);
 
     public void send(MessageContext msgContext, URL url, String soapActionString)
-            throws MalformedURLException, AxisFault, IOException {
+            throws IOException {
 
         // execute the HtttpMethodBase - a connection manager can be given for
         // handle multiple
@@ -113,8 +107,7 @@
     }
 
     private void cleanup(MessageContext msgContext, HttpMethod method) {
-        Object autoClose = msgContext.getOptions().getProperty(HTTPConstants.AUTO_RELEASE_CONNECTION);
-        if (autoClose != null && JavaUtils.isTrueExplicitly(autoClose)) {
+        if (msgContext.isPropertyTrue(HTTPConstants.AUTO_RELEASE_CONNECTION)) {
             method.releaseConnection();
         }
     }
@@ -159,12 +152,14 @@
 
         HttpClient httpClient = getHttpClient(msgContext);
 
+/*  What's up with this, it never gets used anywhere?? --Glen
         String charEncoding =
                 (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
 
         if (charEncoding == null) {
             charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
         }
+*/
 
         PostMethod postMethod = new PostMethod();
         MessageFormatter messageFormatter =
@@ -212,14 +207,14 @@
 
         HttpClient httpClient = getHttpClient(msgContext);
 
+/*  Same deal - this value never gets used, why is it here? --Glen
         String charEncoding =
                 (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
 
         if (charEncoding == null) {
             charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
         }
-
-        // TODO - Do something with charEncoding???
+*/
 
         PutMethod putMethod = new PutMethod();
         MessageFormatter messageFormatter =

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java?view=diff&rev=537322&r1=537321&r2=537322
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java Fri May
11 18:28:40 2007
@@ -342,6 +342,13 @@
         }
     }
 
+    /**
+     * Check if a MessageContext property is true.
+     * @param messageContext the MessageContext
+     * @param propertyName the property name
+     * @return true if the property is Boolean.TRUE, "true", 1, etc. or false otherwise
+     * @deprecated please use MessageContext.isTrue(propertyName) instead
+     */
     public static boolean isExplicitlyTrue(MessageContext messageContext, String propertyName)
{
         Object flag = messageContext.getProperty(propertyName);
         return JavaUtils.isTrueExplicitly(flag);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message