Skip to content

Commit

Permalink
BZ-1100150 - Cannot open 'Process & Task Dashboard' under NAT environ…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
dgutierr committed Jul 29, 2014
1 parent 89cc325 commit f2c5271
Showing 1 changed file with 20 additions and 4 deletions.
Expand Up @@ -52,20 +52,36 @@ protected List<String> explodeUrl(String anUrl) {
results.add(anUrl);

try {
// Get the dashbuilder address (defaults to localhost).
// Get the new address (defaults to localhost).
String bindAddress = System.getProperty("dashbuilder.bind.address");
String bindPort = System.getProperty("dashbuilder.bind.port");
if (StringUtils.isBlank(bindAddress)) {
bindAddress = InetAddress.getLocalHost().getHostAddress();
}

// Add the bind address
String host = new URL(anUrl).getHost();
URL url = new URL(anUrl);
String host = url.getHost();
int port = url.getPort();
String newUrl = anUrl;
if (!host.equals(bindAddress)) {
results.add(anUrl.replace(host, bindAddress));
newUrl = newUrl.replace(host, bindAddress);
}
if (!StringUtils.isBlank(bindPort) && port != Integer.parseInt(bindPort)) {
newUrl = newUrl.replace(Integer.toString(port), bindPort);
}
if (!anUrl.equals(newUrl)) {
results.add(newUrl);
}
} catch (Exception e) {
e.printStackTrace();
}
return results;
}

public static void main(String[] args) {
DashboardRendererServiceImpl s = new DashboardRendererServiceImpl();
for (String s1 : s.explodeUrl("http://localhost:8080/dashbuilder/workspace")) {
System.out.println(s1);
}
}
}

0 comments on commit f2c5271

Please sign in to comment.