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 2014/08/03 22:45:33 UTC

svn commit: r1615451 - /jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js

Author: andy
Date: Sun Aug  3 20:45:33 2014
New Revision: 1615451

URL: http://svn.apache.org/r1615451
Log:
Patched for context path != ''

Modified:
    jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js

Modified: jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js?rev=1615451&r1=1615450&r2=1615451&view=diff
==============================================================================
--- jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js (original)
+++ jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js Sun Aug  3 20:45:33 2014
@@ -23,7 +23,14 @@ define(
     var FusekiServer = Backbone.Model.extend( {
       /** This initializer occurs when the module starts, not when the constructor is invoked */
       init: function( options ) {
-        this._baseURL = sprintf( "http://%s:%s", window.location.hostname, window.location.port );
+        /*this._baseURL = sprintf( "http://%s:%s", window.location.hostname, window.location.port );*/
+	  // The base URL is the page and includes the webapp name.
+	  // No tariling "/"
+	  var b = window.location.href ;
+	  var pat = new RegExp("/[^/]*$","") ;
+	  b = b.replace(pat, "") ;
+          this._baseURL = b ;
+
         this._managementURL = null;
         this.set( "selectedDatasetName", PageUtils.queryParam( "ds" ) )
       },
@@ -65,13 +72,15 @@ define(
 
       /** Load and cache the remote server description. Trigger change event when done */
       loadServerDescription: function() {
-        var self = this;
-        return this.getJSON( "/$/server" ).done( function( data ) {
-                                                   self.saveServerDescription( data );
-                                                 } )
-                                          .then( function() {
-                                                   fui.vent.trigger( "models.fuseki-server.ready" );
-                                                 });
+          var self = this;
+	  var serverDetailsURL = sprintf( "%s/$/server", this.baseURL() );
+          return this.getJSON( serverDetailsURL )
+	      .done( function( data ) {
+                  self.saveServerDescription( data );
+              } )
+              .then( function() {
+                  fui.vent.trigger( "models.fuseki-server.ready" );
+              });
       },
 
       /** Store the server description in this model */