You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/10/18 18:44:54 UTC
[2/2] jena git commit: JENA-1050: Correctly handle port numbers.
JENA-1050: Correctly handle port numbers.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/cbb1d4ee
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/cbb1d4ee
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/cbb1d4ee
Branch: refs/heads/master
Commit: cbb1d4ee8a244adbb96b3fef207f025f846d84ec
Parents: 16d79fd
Author: Andy Seaborne <an...@apache.org>
Authored: Sun Oct 18 17:44:38 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Sun Oct 18 17:44:38 2015 +0100
----------------------------------------------------------------------
.../main/webapp/js/app/models/fuseki-server.js | 52 +++++++++++++-------
1 file changed, 33 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/cbb1d4ee/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/models/fuseki-server.js
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/models/fuseki-server.js b/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/models/fuseki-server.js
index f61a7a1..9c09574 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/models/fuseki-server.js
+++ b/jena-fuseki2/jena-fuseki-core/src/main/webapp/js/app/models/fuseki-server.js
@@ -87,10 +87,14 @@ define(
var mgmtURL = bURL;
if (serverDesc.admin) {
- mgmtURL = bURL.replace( ":" + window.location.port, ":" + serverDesc.admin.port );
- this._managementURL = mgmtURL;
+ // This is too simple. window.location.port may be empty and matches protocol.
+ //mgmtURL = bURL.replace( ":" + window.location.port, ":" + serverDesc.admin.port );
+ //console.log("managementURL -- s/"+window.location.port+"/"+serverDesc.admin.port+"/") ;
+ var path = window.location.pathname.replace( /\/[^/]*$/, "" ) ;
+ mgmtURL = sprintf( "%s//%s:%s%s", window.location.protocol, window.location.hostname, serverDesc.admin, path );
}
-
+ this._managementURL = mgmtURL ;
+
var datasets = _.map( serverDesc.datasets, function( d ) {
return new Dataset( d, bURL, mgmtURL + DATASETS_MANAGEMENT_PATH );
} );
@@ -137,22 +141,32 @@ define(
/** Extract the server root path from the current window href */
currentRootPath: function() {
var path = window.location.pathname.replace( /\/[^/]*$/, "" );
- /*
- console.log("window.location="+window.location) ;
- console.log("window.location.href="+window.location.href) ;
- console.log("window.location.protocol="+window.location.protocol) ;
- console.log("window.location.host="+window.location.host) ;
- console.log("window.location.hostname="+window.location.hostname) ;
- console.log("window.location.port="+window.location.port) ;
- console.log("window.location.pathname="+window.location.pathname) ;
- console.log("window.location.origin="+window.location.origin) ;
- console.log("window.location.hash="+window.location.hash) ;
- console.log("window.location.search="+window.location.search) ;
- console.log("path='"+path+"'") ;
- */
- var path2=sprintf( "%s//%s:%s%s", window.location.protocol, window.location.hostname, window.location.port, path );
- return path2 ;
- // See JENA-868 : port remapping.
+
+ /*
+ console.log("window.location="+window.location) ;
+ console.log("window.location.href="+window.location.href) ;
+ console.log("window.location.protocol="+window.location.protocol) ;
+ console.log("window.location.host="+window.location.host) ;
+ console.log("window.location.hostname="+window.location.hostname) ;
+ console.log("window.location.port="+window.location.port) ;
+ console.log("window.location.pathname="+window.location.pathname) ;
+ console.log("window.location.origin="+window.location.origin) ;
+ console.log("window.location.hash="+window.location.hash) ;
+ console.log("window.location.search="+window.location.search) ;
+ console.log("path='"+path+"'") ;
+ */
+
+ var path2 ;
+ var port = window.location.port ;
+ //console.log("port='"+port+"'") ;
+ if ( !port || 0 === port.length ) {
+ // No explicit port.
+ path2 = sprintf( "%s//%s%s", window.location.protocol, window.location.hostname, path ) ;
+ } else {
+ path2 = sprintf( "%s//%s:%s%s", window.location.protocol, window.location.hostname, window.location.port, path );
+ }
+ //console.log("path2='"+path2+"'") ;
+ return path2 ;
}
} );