Author: tmortagne
Date: 2007-10-15 15:30:04 +0200 (Mon, 15 Oct 2007)
New Revision: 5392
Modified:
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/XWiki.java
Log:
XWIKI-1807: getServerURL(db, context) not including port number when returning
the URL (virtual or main wiki)
Modified:
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
---
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/XWiki.java
2007-10-14 14:08:20 UTC (rev 5391)
+++
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/XWiki.java
2007-10-15 13:30:04 UTC (rev 5392)
@@ -3700,13 +3700,26 @@
getDocument("XWiki.XWikiServer" + database.substring(0,
1).toUpperCase()
+ database.substring(1), context);
BaseObject serverobject =
doc.getObject("XWiki.XWikiServerClass");
- String server =
- (serverobject != null) ?
serverobject.getStringValue("server") : null;
- if (server != null) {
- int mode = serverobject.getIntValue("secure");
- serverurl = ((mode == 1) ? "https://" : "http://") +
server + "/";
+ if (serverobject != null) {
+ String server = serverobject.getStringValue("server");
+ if (server != null) {
+ int mode = serverobject.getIntValue("secure");
+ int port = context.getURL().getPort();
+ if (mode == 1) {
+ if (port != 443) {
+ serverurl = "https://" + server + ":" + port +
"/";
+ } else {
+ serverurl = "https://" + server + "/";
+ }
+ } else {
+ if (port != 80) {
+ serverurl = "http://" + server + ":" + port +
"/";
+ } else {
+ serverurl = "http://" + server + "/";
+ }
+ }
+ }
}
-
} catch (Exception e) {
} finally {
context.setDatabase(db);
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications