Author: lahiru
Date: Tue May 21 20:53:08 2013
New Revision: 1484951

URL: http://svn.apache.org/r1484951
Log:
allowing users enable https.

Modified:
    
airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
    
airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServiceUtils.java

Modified: 
airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java?rev=1484951&r1=1484950&r2=1484951&view=diff
==============================================================================
--- 
airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
 (original)
+++ 
airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
 Tue May 21 20:53:08 2013
@@ -55,6 +55,7 @@ public class ServerSettings extends Appl
     private static final String REGISTRY_DB_USER ="registry.jdbc.user";
     private static final String REGISTRY_DB_PASSWORD ="registry.jdbc.password";
     private static final String REGISTRY_DB_DRIVER ="registry.jdbc.driver";
+    private static final String ENABLE_HTTP = "enable.https";
 
     public static String getDefaultGatewayId()throws 
ApplicationSettingsException{
        return getSetting(DEFAULT_GATEWAY_ID);
@@ -108,7 +109,15 @@ public class ServerSettings extends Appl
         }
 
     }
-    
+
+    public static boolean getEnableHttp() {
+        try {
+            return Boolean.parseBoolean(getSetting(ENABLE_HTTP));
+        } catch (ApplicationSettingsException e) {
+            return false;
+        }
+    }
+
     public static String getTomcatPort() throws ApplicationSettingsException {
        if (tomcatPort==null) {
                        try {

Modified: 
airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServiceUtils.java
URL: 
http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServiceUtils.java?rev=1484951&r1=1484950&r2=1484951&view=diff
==============================================================================
--- 
airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServiceUtils.java
 (original)
+++ 
airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ServiceUtils.java
 Tue May 21 20:53:08 2013
@@ -60,23 +60,25 @@ public class ServiceUtils {
         }
         
         try {
-            port = (String) ServerSettings.getTomcatPort();
+            port = ServerSettings.getTomcatPort();
         } catch (ApplicationSettingsException e) {
                        //we will ignore this exception since the properties 
file will not contain the values
                        //when it is ok to retrieve them from the axis2 context
                }
-        
-        if (port == null) {
-            TransportInDescription transportInDescription = context
+        if(ServerSettings.getEnableHttp()){
+            localAddress = "https://"; + localAddress + ":" + port;
+        }else{
+            if (port == null) {
+                TransportInDescription transportInDescription = context
                     .getAxisConfiguration().getTransportsIn()
                     .get("http");
-            if (transportInDescription != null
+                if (transportInDescription != null
                     && transportInDescription.getParameter(PORT) != null) {
-                port = (String) transportInDescription
+                    port = (String) transportInDescription
                         .getParameter(PORT).getValue();
+                }
+                localAddress = "http://"; + localAddress + ":" + port;
             }
-        }
-        localAddress = "http://"; + localAddress + ":" + port;
         localAddress = localAddress + "/"
                        //We are not using axis2 config context to get the 
context root because it is invalid
                 //+ context.getContextRoot() + "/"
@@ -84,6 +86,7 @@ public class ServiceUtils {
                 + ServerSettings.getServerContextRoot() + "/"
                 + context.getServicePath() + "/"
                 + serviceName;
+        }
         log.debug("Service Address Configured:" + localAddress);
         return localAddress;
        }


Reply via email to