Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9B306DDCD for ; Tue, 21 May 2013 20:53:32 +0000 (UTC) Received: (qmail 13690 invoked by uid 500); 21 May 2013 20:53:33 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 13660 invoked by uid 500); 21 May 2013 20:53:33 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 13653 invoked by uid 99); 21 May 2013 20:53:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 May 2013 20:53:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 May 2013 20:53:30 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 38A682388A32; Tue, 21 May 2013 20:53:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1484951 - in /airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils: ServerSettings.java ServiceUtils.java Date: Tue, 21 May 2013 20:53:09 -0000 To: commits@airavata.apache.org From: lahiru@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130521205309.38A682388A32@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; }