axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sami...@apache.org
Subject svn commit: r442922 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http: AbstractHTTPSender.java HTTPConstants.java HTTPCredentialProvider.java HttpTransportProperties.java RESTSender.java SOAPOverHTTPSender.java
Date Wed, 13 Sep 2006 09:58:59 GMT
Author: saminda
Date: Wed Sep 13 02:58:58 2006
New Revision: 442922

URL: http://svn.apache.org/viewvc?view=rev&rev=442922
Log:
1. Removed NTLMAuth and BasicAuth innerclasses outof 
HttpTransportProperties and introduced Authenticator inner class. This 
class assosiate with HtttpConstants.AUTHENTICATE. If one want to do 
NTLM, Digest or Basic Auth one has to fill the Authenticator bean and 
set it with this property. Httpclinent will internally handles whether 
to use NTLM, Digest or Basic Auth. 

Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPCredentialProvider.java
Modified:
    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/HTTPConstants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java

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=442922&r1=442921&r2=442922
==============================================================================
--- 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
Wed Sep 13 02:58:58 2006
@@ -26,23 +26,11 @@
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.util.Utils;
 import org.apache.axis2.util.JavaUtils;
-import org.apache.commons.httpclient.Credentials;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HeaderElement;
-import org.apache.commons.httpclient.HostConfiguration;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.NTCredentials;
-import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.axis2.util.Utils;
+import org.apache.commons.httpclient.*;
 import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.auth.CredentialsProvider;
-import org.apache.commons.httpclient.auth.AuthScheme;
-import org.apache.commons.httpclient.auth.CredentialsNotAvailableException;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -69,6 +57,8 @@
     private static final Log log = LogFactory.getLog(AbstractHTTPSender.class);
     int soTimeout = HTTPConstants.DEFAULT_SO_TIMEOUT;
 
+    protected boolean authenticationEnabled;
+
     /**
      * proxydiscription
      */
@@ -91,7 +81,7 @@
             } else {
                 throw new AxisFault(
                         "Parameter " + HTTPConstants.PROTOCOL_VERSION
-                                + " Can have values only HTTP/1.0 or HTTP/1.1");
+                        + " Can have values only HTTP/1.0 or HTTP/1.1");
             }
         }
     }
@@ -145,11 +135,11 @@
                     proxyCred = new UsernamePasswordCredentials("", "");
                 } else {
                     proxyCred = new UsernamePasswordCredentials(usrName,
-                            passwd);    // proxy
+                                                                passwd);    // proxy
                 }
             } else {
                 proxyCred = new NTCredentials(usrName, passwd, proxyHostName,
-                        domain);    // NTLM authentication with additionals prams
+                                              domain);    // NTLM authentication with additionals
prams
             }
         }
 
@@ -164,16 +154,16 @@
 
             proxyHostName = proxyProperties.getProxyHostName();
             if (proxyHostName == null
-                    || proxyHostName.length() == 0) {
+                || proxyHostName.length() == 0) {
                 throw new AxisFault("Proxy Name is not valid");
             }
 
             if (proxyProperties.getUserName().equals(ANONYMOUS)
-                    || proxyProperties.getPassWord().equals(ANONYMOUS)) {
+                || proxyProperties.getPassWord().equals(ANONYMOUS)) {
                 proxyCred = new UsernamePasswordCredentials("", "");
             }
             if (!proxyProperties.getUserName().equals(ANONYMOUS) &&
-                    !proxyProperties.getPassWord().equals(ANONYMOUS)) {
+                !proxyProperties.getPassWord().equals(ANONYMOUS)) {
                 proxyCred = new UsernamePasswordCredentials(
                         proxyProperties.getUserName().trim(),
                         proxyProperties
@@ -181,9 +171,8 @@
             }
             if (!proxyProperties.getDomain().equals(ANONYMOUS)) {
                 if (!proxyProperties.getUserName().equals(ANONYMOUS) &&
-                        !proxyProperties.getPassWord().equals(ANONYMOUS) &&
-                        !proxyProperties.getDomain().equals(ANONYMOUS) &&
-                        proxyHostName != null) {
+                    !proxyProperties.getPassWord().equals(ANONYMOUS) &&
+                    !proxyProperties.getDomain().equals(ANONYMOUS)) {
                     proxyCred = new NTCredentials(
                             proxyProperties.getUserName().trim(),
                             proxyProperties.getPassWord().trim(), proxyHostName,
@@ -227,7 +216,7 @@
                 } else if (charsetEnc != null) {
                     if (opContext != null) {
                         opContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
-                                charsetEnc.getValue());    // change to the value, which
is text/xml or application/xml+soap
+                                              charsetEnc.getValue());    // change to the
value, which is text/xml or application/xml+soap
                     }
                 }
             }
@@ -278,9 +267,9 @@
                         new GZIPInputStream(in);
             } else {
                 throw new AxisFault("HTTP :"
-                        + "unsupported content-encoding of '"
-                        + contentEncoding.getValue()
-                        + "' found");
+                                    + "unsupported content-encoding of '"
+                                    + contentEncoding.getValue()
+                                    + "' found");
             }
         }
 
@@ -309,7 +298,7 @@
             throws AxisFault {
         boolean isHostProxy = isProxyListed(msgCtx);    // list the proxy
 
-        boolean authenticationEnabled = serverPreemtiveAuthentication(msgCtx); // server
authentication
+        authenticationEnabled = serverPreemtiveAuthentication(msgCtx); // server authentication
         int port = targetURL.getPort();
 
         if (port == -1) {
@@ -328,100 +317,41 @@
 
             // proxy configuration
             this.configProxyAuthentication(client, proxyOutSetting, config,
-                    msgCtx);
+                                           msgCtx);
         }
 
         return config;
     }
 
-    private boolean NTLMAuthentication(HttpClient agent,
-                                       MessageContext msgCtx) {
-        HttpTransportProperties.NTLMAuthentication ntlmAuthentication =
-                (HttpTransportProperties.NTLMAuthentication) msgCtx
-                        .getProperty(HTTPConstants.NTLM_AUTHENTICATION);
-        Credentials defaultCredentials;
-        if (ntlmAuthentication != null) {
-
-            if (ntlmAuthentication.getRealm() == null) {
-                defaultCredentials = new UsernamePasswordCredentials(
-                        ntlmAuthentication.getUsername(),
-                        ntlmAuthentication.getPassword());
-            } else {
-                defaultCredentials = new NTCredentials(
-                        ntlmAuthentication.getUsername(),
-                        ntlmAuthentication.getPassword(),
-                        ntlmAuthentication.getHost(),
-                        ntlmAuthentication.getRealm());
-            }
-            agent.getState().setCredentials(new AuthScope(
-                    ntlmAuthentication.getHost(),
-                    ntlmAuthentication.getPort(),
-                    AuthScope.ANY_REALM,
-                    AuthScope.ANY_SCHEME), defaultCredentials);
-            setCredentialsProvider(agent, defaultCredentials);
-            return true;
-        }
-        return false;
-
-    }
-
-    private void setCredentialsProvider(HttpClient agent, final Credentials credentials)
{
-        agent.getParams().setParameter(CredentialsProvider.PROVIDER, new CredentialsProvider()
{
-            public Credentials getCredentials(AuthScheme authScheme, String string, int i,
boolean b)
-                    throws CredentialsNotAvailableException {
-                return credentials;
-            }
-        });
-    }
-
-    private void configServerPreemtiveAuthenticaiton(HttpClient agent,
-                                                     MessageContext msgCtx,
-                                                     HostConfiguration config,
-                                                     URL targetURL) {
+    /*
+    This will handle server Authentication, It could be either NTLM, Digest or Basic Authentication
+    */
+    protected void configServerPreemtiveAuthenticaiton(HttpClient agent,
+                                                       MessageContext msgCtx,
+                                                       HostConfiguration config,
+                                                       URL targetURL) throws AxisFault {
         config.setHost(targetURL.getHost(), targetURL.getPort(),
-                targetURL.getProtocol());
+                       targetURL.getProtocol());
 
         agent.getParams().setAuthenticationPreemptive(true);
 
+        HttpTransportProperties.Authenticator authenticator;
+        Object obj = msgCtx.getProperty(HTTPConstants.AUTHENTICATE);
+        if (obj != null) {
+            if (obj instanceof HttpTransportProperties.Authenticator) {
+                authenticator = (HttpTransportProperties.Authenticator) obj;
+                agent.getParams().setParameter(
+                        CredentialsProvider.PROVIDER,
+                        new HTTPCredentialProvider(authenticator.getHost(),
+                                                   authenticator.getRealm(),
+                                                   authenticator.getUsername(),
+                                                   authenticator.getPassword()));
 
-        Credentials defaultCredentials = null;
-
-        // check for NTLM Authentication
-        boolean bntlm = NTLMAuthentication(agent, msgCtx);
-
-        HttpTransportProperties.BasicAuthentication basicAuthentication =
-                (HttpTransportProperties.BasicAuthentication) msgCtx
-                        .getProperty(HTTPConstants.BASIC_AUTHENTICATION);
-
-        if (basicAuthentication != null && !bntlm) {
-            defaultCredentials = new UsernamePasswordCredentials(
-                    basicAuthentication.getUsername(),
-                    basicAuthentication.getPassword());
-            if (basicAuthentication.getPort() == -1 ||
-                    basicAuthentication.getHost() == null) {
-                agent.getState()
-                        .setCredentials(AuthScope.ANY, defaultCredentials);
             } else {
-                if (basicAuthentication.getRealm() == null) {
-                    agent.getState().setCredentials(new AuthScope(
-                            basicAuthentication.getHost(),
-                            basicAuthentication.getPort(),
-                            AuthScope.ANY_REALM,
-                            AuthScope.ANY_SCHEME), defaultCredentials);
-
-                } else {
-                    agent.getState().setCredentials(new AuthScope(
-                            basicAuthentication.getHost(),
-                            basicAuthentication.getPort(),
-                            basicAuthentication.getRealm(),
-                            AuthScope.ANY_SCHEME),
-                            defaultCredentials);
-                }
+                throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
             }
-            setCredentialsProvider(agent, defaultCredentials);
         }
 
-
     }
 
     /**
@@ -460,8 +390,7 @@
 
     private boolean serverPreemtiveAuthentication(MessageContext msgContext) {
 
-        return (msgContext.getProperty(HTTPConstants.BASIC_AUTHENTICATION) !=
-                null || msgContext.getProperty(HTTPConstants.NTLM_AUTHENTICATION) != null);
+        return (msgContext.getProperty(HTTPConstants.AUTHENTICATE) != null);
     }
 
     private boolean isProxyListed(MessageContext msgCtx) throws AxisFault {
@@ -615,7 +544,7 @@
 
             // action header is not mandated in SOAP 1.2. So putting it, if available
             if (!msgCtxt.isSOAP11() && (soapActionString != null)
-                    && !"".equals(soapActionString.trim())) {
+                && !"".equals(soapActionString.trim())) {
                 contentType =
                         contentType + ";action=\"" + soapActionString + "\";";
             }
@@ -629,14 +558,17 @@
     }
 
     protected HttpClient getHttpClient(MessageContext msgContext) {
-        HttpClient httpClient = null;
+        HttpClient httpClient;
         Object reuse = msgContext.getOptions().getProperty(HTTPConstants.REUSE_HTTP_CLIENT);
         if (reuse != null && JavaUtils.isTrueExplicitly(reuse)) {
-            httpClient = (HttpClient) msgContext.getConfigurationContext().getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
+            httpClient = (HttpClient) msgContext.getConfigurationContext()
+                    .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
             if (httpClient == null) {
-                MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
+                MultiThreadedHttpConnectionManager connectionManager =
+                        new MultiThreadedHttpConnectionManager();
                 httpClient = new HttpClient(connectionManager);
-                msgContext.getConfigurationContext().setProperty(HTTPConstants.CACHED_HTTP_CLIENT,
httpClient);
+                msgContext.getConfigurationContext()
+                        .setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
             }
         } else {
             httpClient = new HttpClient();
@@ -653,26 +585,25 @@
         return httpClient;
     }
 
-    protected void executeMethod(HttpClient httpClient, MessageContext msgContext, URL url,
HttpMethod method) throws IOException {
+    protected void executeMethod(HttpClient httpClient, MessageContext msgContext, URL url,
+                                 HttpMethod method) throws IOException {
         HostConfiguration config = this.getHostConfiguration(httpClient, msgContext, url);
         msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
 
-
         // set the custom headers, if available
         addCustomHeaders(method, msgContext);
 
         // add compression headers if needed
         if (Utils.isExplicitlyTrue(msgContext, HTTPConstants.MC_ACCEPT_GZIP)) {
             method.addRequestHeader(HTTPConstants.HEADER_ACCEPT_ENCODING,
-                    HTTPConstants.COMPRESSION_GZIP);
+                                    HTTPConstants.COMPRESSION_GZIP);
         }
         if (Utils.isExplicitlyTrue(msgContext, HTTPConstants.MC_GZIP_REQUEST)) {
             method.addRequestHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
-                    HTTPConstants.COMPRESSION_GZIP);
+                                    HTTPConstants.COMPRESSION_GZIP);
         }
 
 
-
         httpClient.executeMethod(config, method);
     }
 
@@ -705,7 +636,8 @@
         String userAgentString = "Axis2";
         boolean locked = false;
         if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null) {
-            OMElement userAgentElement = messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();
+            OMElement userAgentElement =
+                    messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();
             userAgentString = userAgentElement.getText().trim();
             OMAttribute lockedAttribute = userAgentElement.getAttribute(new QName("locked"));
             if (lockedAttribute != null) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java?view=diff&rev=442922&r1=442921&r2=442922
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java
Wed Sep 13 02:58:58 2006
@@ -382,8 +382,7 @@
     public static final String PROXY = "PROXY";
     public static final String MAIL_SMTP = "_MAIL_SMTP_";
     public static final String MAIL_POP3 = "_MAIL_POP3_";
-    public static final String BASIC_AUTHENTICATION = "_BASIC_AUTHENTICATION_";
-    public static final String NTLM_AUTHENTICATION = "_NTLM_AUTHENTICATION_";
+    public static final String AUTHENTICATE = "_NTML_DIGEST_BASIC_AUTHENTICATION_";
     public static final String MTOM_RECEIVED_CONTENT_TYPE = "MTOM_RECEIVED";
 
     /**

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPCredentialProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPCredentialProvider.java?view=auto&rev=442922
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPCredentialProvider.java
(added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPCredentialProvider.java
Wed Sep 13 02:58:58 2006
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.transport.http;
+
+import org.apache.commons.httpclient.auth.*;
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.NTCredentials;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.IOException;
+/*
+ * 
+ */
+
+public class HTTPCredentialProvider implements CredentialsProvider {
+
+    private static Log log = LogFactory.getLog(HTTPCredentialProvider.class);
+
+    private String host;
+    private String realm;
+    private String username;
+    private String password;
+
+
+    public HTTPCredentialProvider(String host, String realm, String username, String password)
{
+        this.host = host;
+        this.realm = realm;
+        this.username = username;
+        this.password = password;
+
+    }
+
+    public Credentials getCredentials(AuthScheme authscheme, String string, int i, boolean
b)
+            throws CredentialsNotAvailableException {
+        if (authscheme == null) {
+            return null;
+        }
+        try {
+            if (authscheme instanceof NTLMScheme) {
+                log.debug("NTLM Authentication authentication");
+                if (username == null || password == null || host == null || realm == null)
{
+                    throw new CredentialsNotAvailableException(
+                            "user or password or host or realm cannot be Null");
+                }
+                return new NTCredentials(username, password, host, realm);
+            } else if (authscheme instanceof RFC2617Scheme) {
+                log.debug(host + " : " + " requires authentication with the realm '"
+                          + authscheme.getRealm() + "'");
+                return new UsernamePasswordCredentials(username, password);
+            } else {
+                throw new CredentialsNotAvailableException("Unsupported authentication scheme:
" +
+                                                           authscheme.getSchemeName());
+            }
+        } catch (IOException e) {
+            throw new CredentialsNotAvailableException(e.getMessage(), e);
+        }
+
+    }
+}

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java?view=diff&rev=442922&r1=442921&r2=442922
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java
Wed Sep 13 02:58:58 2006
@@ -117,54 +117,13 @@
             this.userName = userName;
         }
     }
-    public static class BasicAuthentication{
-        private String host;
-        private int port = -1;
-        private String realm;
-        private String username;
-        private String password;
-
-        public String getHost() {
-            return host;
-        }
-
-        public void setHost(String host) {
-            this.host = host;
-        }
-
-        public int getPort() {
-            return port;
-        }
-
-        public void setPort(int port) {
-            this.port = port;
-        }
-
-        public String getRealm() {
-            return realm;
-        }
-
-        public void setRealm(String realm) {
-            this.realm = realm;
-        }
-
-        public String getUsername() {
-            return username;
-        }
-
-        public void setUsername(String username) {
-            this.username = username;
-        }
-
-        public String getPassword() {
-            return password;
-        }
-
-        public void setPassword(String password) {
-            this.password = password;
-        }
-    }
-    public static class NTLMAuthentication{
+    /*
+    This class is responsible for holding all the necessary information needed for NTML,
Digest
+    and Basic Authentication. Authentication itself is handled by httpclient. User doesn't
need to
+    warry about what authentication mechanism it uses. Axis2 uses httpclinet's default authentication
+    patterns.
+    */
+    public static class Authenticator{
         private String host;
         private int port = -1;
         private String realm;

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java?view=diff&rev=442922&r1=442921&r2=442922
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java
Wed Sep 13 02:58:58 2006
@@ -144,6 +144,9 @@
             throws MalformedURLException, AxisFault, IOException {
         String param = getParam(msgContext);
         GetMethod getMethod = new GetMethod();
+        if (authenticationEnabled) {
+            getMethod.setDoAuthentication(true);
+        }
 
         if (param != null && param.length() > 0) {
             getMethod.setPath(url.getFile() + "?" + param);
@@ -172,7 +175,6 @@
         if (getMethod.getStatusCode() == HttpStatus.SC_OK) {
             processResponse(getMethod, msgContext);
         } else if (getMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
-            return;
         } else if (getMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
             Header contenttypeHheader =
                     getMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
@@ -198,8 +200,10 @@
         // handle multiple
         HttpClient httpClient = getHttpClient(msgContext);
 
-        // todo giving proxy and NTLM support
         PostMethod postMethod = new PostMethod(url.toString());
+        if(authenticationEnabled) {
+            postMethod.setDoAuthentication(true);
+        }
         String httpContentType;
 
         if (msgContext.getProperty(Constants.Configuration.CONTENT_TYPE) != null) {
@@ -227,8 +231,7 @@
             if (reqData.bodyRequest == null) {
                 reqData.bodyRequest = "0";
             }
-            postMethod.setRequestEntity(new AxisRESTRequestEntity(reqData.bodyRequest,
-                    charEncoding, msgContext, httpContentType));
+            postMethod.setRequestEntity(new AxisRESTRequestEntity(reqData.bodyRequest,httpContentType));
 
         } else {
             postMethod.setPath(url.getPath());
@@ -321,16 +324,11 @@
     }
 
     public class AxisRESTRequestEntity implements RequestEntity {
-        private String charSetEnc;
         private String contentType;
-        private MessageContext msgCtxt;
         private String postRequestBody;
 
-        public AxisRESTRequestEntity(String postRequestBody, String charSetEnc,
-                                     MessageContext msgCtxt, String contentType) {
+        public AxisRESTRequestEntity(String postRequestBody,String contentType) {
             this.postRequestBody = postRequestBody;
-            this.charSetEnc = charSetEnc;
-            this.msgCtxt = msgCtxt;
             this.contentType = contentType;
         }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java?view=diff&rev=442922&r1=442921&r2=442922
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
Wed Sep 13 02:58:58 2006
@@ -54,6 +54,9 @@
         // handle multiple
         HttpClient httpClient = getHttpClient(msgContext);
         PostMethod postMethod = new PostMethod(url.toString());
+        if (authenticationEnabled) {
+            postMethod.setDoAuthentication(true);
+        }
 
         String charEncoding =
                 (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
@@ -173,7 +176,7 @@
 				 StringWriter bufferedSOAPBody = new StringWriter();
 				//To support NTLM Authentication the following check has been
 				// done.
-				if (msgCtxt.getProperty(HTTPConstants.NTLM_AUTHENTICATION) != null) {
+				if (msgCtxt.getProperty(HTTPConstants.AUTHENTICATE) != null) {
 					element.serialize(bufferedSOAPBody, format);
 				} else {
 					element.serializeAndConsume(bufferedSOAPBody, format);
@@ -182,7 +185,7 @@
 			} else {
 				// To support NTLM Authentication the following check has been
 				// done.
-				if (msgCtxt.getProperty(HTTPConstants.NTLM_AUTHENTICATION) != null) {
+				if (msgCtxt.getProperty(HTTPConstants.AUTHENTICATE) != null) {
 					element.serialize(out, format);
 				} else {
 					element.serializeAndConsume(out, format);



---------------------------------------------------------------------
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