[jboss-cvs] JBossAS SVN: r109591 - branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/util/web.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 30 17:55:51 EST 2010
Author: rachmatowicz at jboss.com
Date: 2010-11-30 17:55:51 -0500 (Tue, 30 Nov 2010)
New Revision: 109591
Modified:
branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/util/web/HttpUtils.java
Log:
Fix URL generation in HttpUtils (JBAS-8540)
Modified: branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/util/web/HttpUtils.java
===================================================================
--- branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/util/web/HttpUtils.java 2010-11-30 22:53:41 UTC (rev 109590)
+++ branches/JBoss-AS-6.0.x-ipv6/testsuite/src/main/org/jboss/test/util/web/HttpUtils.java 2010-11-30 22:55:51 UTC (rev 109591)
@@ -45,8 +45,8 @@
public class HttpUtils
{
private static Logger log = Logger.getLogger(HttpUtils.class);
- private static String baseURL = "http://jduke:theduke@" + System.getProperty("jbosstest.server.host", "localhost") + ":" + Integer.getInteger("web.port", 8080) + "/";
- private static String baseURLNoAuth = "http://" + System.getProperty("jbosstest.server.host", "localhost") + ":" + Integer.getInteger("web.port", 8080) + "/";
+ private static String baseURL = "http://jduke:theduke@" + getServerHostForURL() + ":" + Integer.getInteger("web.port", 8080) + "/";
+ private static String baseURLNoAuth = "http://" + getServerHostForURL() + ":" + Integer.getInteger("web.port", 8080) + "/";
public static final int GET = 1;
public static final int POST = 2;
@@ -56,13 +56,33 @@
public static final int DELETE = 6;
public static final int TRACE = 7;
+ // JBAS-8540
+ private getServerHost() {
+ String hostName = System.getProperty("jbosstest.server.host", "localhost") ;
+ return hostName;
+ }
+
+ private String getServerHostForURL()
+ {
+ String hostName = getServerHost() ;
+
+ if (hostName == null)
+ return hostName;
+
+ // check for IPv6 literal
+ if (hostName.indexOf(":") != -1)
+ return "[" + hostName + "]" ;
+ else
+ return hostName ;
+ }
+
public static String getBaseURL()
{
return baseURL;
}
public static String getBaseURL(String username, String password)
{
- String url = "http://"+username+":"+password+"@" + System.getProperty("jbosstest.server.host", "localhost") + ":"
+ String url = "http://"+username+":"+password+"@" + getServerHostForURL() + ":"
+ Integer.getInteger("web.port", 8080) + "/";
return url;
}
More information about the jboss-cvs-commits
mailing list