Weird preview problem was fixed
authorEugene Ostroukhov <eugeneo@symbian.org>
Tue, 02 Feb 2010 17:20:45 -0800
changeset 90 278f8e3868ff
parent 89 42ca8399be33
child 91 ca4b5c63386b
Weird preview problem was fixed
org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WebappManager.java
org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/MozillaPreviewPage.java
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WebappManager.java	Tue Feb 02 14:59:54 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/WebappManager.java	Tue Feb 02 17:20:45 2010 -0800
@@ -18,6 +18,8 @@
  *******************************************************************************/
 package org.symbian.tools.wrttools.previewer.http;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.logging.Level;
@@ -122,7 +124,11 @@
 
 	public static String getHost() {
 		if (host == null) {
-			host = "127.0.0.1"; //$NON-NLS-1$
+			try {
+				host = InetAddress.getLocalHost().getHostName();
+			} catch (Exception e) {
+				host = "127.0.0.1";
+			}
 		}
 		return host;
 	}
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/MozillaPreviewPage.java	Tue Feb 02 14:59:54 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/MozillaPreviewPage.java	Tue Feb 02 17:20:45 2010 -0800
@@ -137,7 +137,7 @@
 			mozillaPrefs.setCharPref("capability.policy.default.XMLHttpRequest.setRequestHeader", "allAccess");
 			/* to over-ride the internet security dialog when preview browser tries to access local hard drive */
 			mozillaPrefs.setCharPref("capability.principal.codebase.p0.granted", "UniversalXPConnect  UniversalBrowserRead");
-			String location = "http://127.0.0.1:" + WebappManager.getPort();
+			String location = "http://" + WebappManager.getHost() + ":" + WebappManager.getPort();
 			mozillaPrefs.setCharPref("capability.principal.codebase.p0.id", location);
 			mozillaPrefs.setBoolPref("security.fileuri.strict_origin_policy", 0);
 		} catch (Exception e) {