You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by az...@apache.org on 2010/12/29 10:32:30 UTC

svn commit: r1053581 - in /axis/axis2/java/core/trunk/modules: kernel/src/org/apache/axis2/JAXRS/ kernel/src/org/apache/axis2/deployment/util/ kernel/src/org/apache/axis2/description/java2wsdl/ kernel/src/org/apache/axis2/java/security/ kernel/src/org/...

Author: azeez
Date: Wed Dec 29 09:32:29 2010
New Revision: 1053581

URL: http://svn.apache.org/viewvc?rev=1053581&view=rev
Log:
1. Fix AXIS2-2944
2. s/JAXRS/jaxrs according the standard Java package naming conventions


Added:
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/SSLProtocolSocketFactory.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/TrustAllTrustManager.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/
      - copied from r1051884, axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/JAXRS/
Removed:
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/JAXRS/
Modified:
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSModel.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSUtils.java
    axis/axis2/java/core/trunk/modules/osgi/pom.xml

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?rev=1053581&r1=1053580&r2=1053581&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Wed Dec 29 09:32:29 2010
@@ -27,7 +27,7 @@ import org.apache.axiom.soap.SOAP12Const
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.classloader.JarFileClassLoader;
 import org.apache.axis2.Constants;
-import org.apache.axis2.JAXRS.JAXRSModel;
+import org.apache.axis2.jaxrs.JAXRSModel;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.deployment.DeploymentClassLoader;
 import org.apache.axis2.deployment.DeploymentConstants;

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=1053581&r1=1053580&r2=1053581&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Wed Dec 29 09:32:29 2010
@@ -20,8 +20,8 @@
 package org.apache.axis2.description.java2wsdl;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.JAXRS.JAXRSUtils;
-import org.apache.axis2.JAXRS.JAXRSModel;
+import org.apache.axis2.jaxrs.JAXRSUtils;
+import org.apache.axis2.jaxrs.JAXRSModel;
 import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.deployment.util.BeanExcludeInfo;
 import org.apache.axis2.deployment.util.Utils;

Added: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/SSLProtocolSocketFactory.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/SSLProtocolSocketFactory.java?rev=1053581&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/SSLProtocolSocketFactory.java (added)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/SSLProtocolSocketFactory.java Wed Dec 29 09:32:29 2010
@@ -0,0 +1,82 @@
+/*                                                                             
+ * 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.java.security;
+
+import org.apache.commons.httpclient.params.HttpConnectionParams;
+import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
+
+import javax.net.SocketFactory;
+import javax.net.ssl.SSLContext;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+
+/**
+ * @see TrustAllTrustManager
+ */
+public class SSLProtocolSocketFactory implements SecureProtocolSocketFactory {
+    SSLContext ctx;
+
+    public SSLProtocolSocketFactory(SSLContext ctx) {
+        this.ctx = ctx;
+    }
+
+    public Socket createSocket(final String host, final int port, final InetAddress localAddress,
+                               final int localPort, final HttpConnectionParams params) throws
+                                                                                       IOException {
+        if (params == null) {
+            throw new IllegalArgumentException("Parameters may not be null");
+        }
+        int timeout = params.getConnectionTimeout();
+        SocketFactory socketfactory = ctx.getSocketFactory();
+        if (timeout == 0) {
+            return socketfactory.createSocket(host, port, localAddress, localPort);
+        } else {
+            Socket socket = socketfactory.createSocket();
+            SocketAddress localaddr = new InetSocketAddress(localAddress, localPort);
+            SocketAddress remoteaddr = new InetSocketAddress(host, port);
+            socket.bind(localaddr);
+            socket.connect(remoteaddr, timeout);
+            return socket;
+        }
+    }
+
+    /**
+     * @see SecureProtocolSocketFactory#createSocket(java.lang.String, int, java.net.InetAddress, int)
+     */
+    public Socket createSocket(String host, int port, InetAddress clientHost, int clientPort)
+            throws IOException {
+        return ctx.getSocketFactory().createSocket(host, port, clientHost, clientPort);
+    }
+
+    /**
+     * @see SecureProtocolSocketFactory#createSocket(java.lang.String, int)
+     */
+    public Socket createSocket(String host, int port) throws IOException {
+        return ctx.getSocketFactory().createSocket(host, port);
+    }
+
+    /**
+     * @see SecureProtocolSocketFactory#createSocket(java.net.Socket, java.lang.String, int, boolean)
+     */
+    public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
+            throws IOException {
+        return ctx.getSocketFactory().createSocket(socket, host, port, autoClose);
+    }
+
+}

Added: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/TrustAllTrustManager.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/TrustAllTrustManager.java?rev=1053581&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/TrustAllTrustManager.java (added)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/java/security/TrustAllTrustManager.java Wed Dec 29 09:32:29 2010
@@ -0,0 +1,54 @@
+/*                                                                             
+ * 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.java.security;
+
+import javax.net.ssl.X509TrustManager;
+
+/**
+ * Normally when we connect over HTTPS, if the server sends us a certificate that is not well
+ * known,  we have to specify a keystore using system properties:
+ * <p/>
+ * System.setProperty("javax.net.ssl.trustStore","path to keystore" );
+ * System.setProperty("javax.net.ssl.trustStorePassword","apache");
+ * <p/>
+ * Using this X509TrustManager we can allow the client to disregard the certificate and trust the
+ * server. One of the reason this may be done is because clients are sometimes deployed on systems
+ * where the developers haveno access to the file system and therefore cannot configure the
+ * keystores.
+ * <p/>
+ * This TrustManager can be used in the client stub as follows:
+ * <p/>
+ * <pre>
+ * <code>
+ * SSLContext sslCtx = SSLContext.getInstance("http");
+ * sslCtx.init(null, new TrustManager[] {new TrustAllTrustManager()}, null);
+ * stub._getServiceClient().getOptions().setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
+ *          new Protocol("https",(ProtocolSocketFactory)new SSLProtocolSocketFactory(sslCtx),443));
+ * </code>
+ * </pre>
+ * @see SSLProtocolSocketFactory
+ */
+public class TrustAllTrustManager implements X509TrustManager {
+    public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+        return null;
+    }
+
+    public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+    }
+
+    public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+    }
+}

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSModel.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSModel.java?rev=1053581&r1=1051884&r2=1053581&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSModel.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSModel.java Wed Dec 29 09:32:29 2010
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.axis2.JAXRS;
+package org.apache.axis2.jaxrs;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSUtils.java?rev=1053581&r1=1051884&r2=1053581&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSUtils.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/jaxrs/JAXRSUtils.java Wed Dec 29 09:32:29 2010
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.axis2.JAXRS;
+package org.apache.axis2.jaxrs;
 
 
 import org.apache.axis2.Constants;

Modified: axis/axis2/java/core/trunk/modules/osgi/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi/pom.xml?rev=1053581&r1=1053580&r2=1053581&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/osgi/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/osgi/pom.xml Wed Dec 29 09:32:29 2010
@@ -106,6 +106,7 @@
                             javax.wsdl.extensions.*,
                             javax.wsdl.factory,
                             javax.wsdl.xml,
+                            javax.net.*,
                             javax.xml.parsers;resolution:=optional,
                             javax.xml.stream;resolution:=optional;version="1.0",
                             javax.xml.transform;resolution:=optional,