- // Construct full URL
- String baseUrl = String.format("%s://%s%s", scheme, hostName, path); //NOI18N
+ if (null == servletPath) {
+ // Set to empty string
+ servletPath = ""; //NOI18N
+ }
+
+ // Init variable
+ String baseUrl;
+
+ // Unusual port found?
+ if ((port != 80) && (port != 443)) {
+ // Construct full URL
+ baseUrl = String.format("%s://%s:%d%s%s", scheme, serverName, port, contextPath, servletPath); //NOI18N
+ } else {
+ // Construct full URL
+ baseUrl = String.format("%s://%s%s%s", scheme, serverName, contextPath, servletPath); //NOI18N
+ }