Try to resolve api url from otherProperties
authorKostas Papadimitriou <kpap@grnet.gr>
Fri, 31 May 2013 14:32:56 +0000 (17:32 +0300)
committerKostas Papadimitriou <kpap@grnet.gr>
Fri, 31 May 2013 14:37:17 +0000 (17:37 +0300)
check otherProperties.STORAGE_API_URL. Fallback to config defaults.

Refs: #3884

src/gr/grnet/pithos/web/client/Pithos.java

index 84079df..9ff7b2b 100644 (file)
@@ -93,7 +93,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
     }
 
     public static final Configuration config = GWT.create(Configuration.class);
-    public static final String CONFIG_API_PATH = config.apiPath();
+    public static final String CONFIG_API_PATH = getFromOtherPropertiesOrDefaultString("STORAGE_API_URL", config.apiPath());
     static {
         LOG("CONFIG_API_PATH = ", CONFIG_API_PATH);
     }
@@ -108,6 +108,14 @@ public class Pithos implements EntryPoint, ResizeHandler {
             return null;
         }
     }
+    public static String getFromOtherPropertiesOrDefaultString(String key, String dflt) {
+        try {
+            return otherProperties.get(key);
+        }
+        catch(Exception e) {
+            return dflt;
+        }
+    }
     public static final String OTHERPROPS_STORAGE_API_URL = getFromOtherPropertiesOrNull("STORAGE_API_URL");
     public static final String OTHERPROPS_USER_CATALOGS_API_URL = getFromOtherPropertiesOrNull("USER_CATALOGS_API_URL");
     static {