Bug 377823 - Investigate packaging orion as a WAR file
 - bulk of the fixes
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
index c48092c..4ba341a 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
@@ -2416,7 +2416,7 @@
 						findCommitLocation(repositories, data.parameters.valueFor("commitName")).then( //$NON-NLS-0$
 							function(commitLocation){
 								if(commitLocation !== null){
-									var commitPageURL = "/git/git-commit.html#" + commitLocation + "?page=1&pageSize=1"; //$NON-NLS-1$ //$NON-NLS-0$
+									var commitPageURL = require.toUrl("git/git-commit.html#") + commitLocation + "?page=1&pageSize=1"; //$NON-NLS-1$ //$NON-NLS-0$
 									window.open(commitPageURL);
 								}
 							}, function () {
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommitExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommitExplorer.js
index ac0a32f..a3a00b4 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommitExplorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommitExplorer.js
@@ -12,9 +12,9 @@
 /*global define window console document Image */

 

 define(

-		[ 'i18n!git/nls/gitmessages', 'orion/section', 'orion/explorers/explorer', 'orion/PageUtil', 'orion/i18nUtil', 'orion/webui/littlelib',

+		[ 'require', 'i18n!git/nls/gitmessages', 'orion/section', 'orion/explorers/explorer', 'orion/PageUtil', 'orion/i18nUtil', 'orion/webui/littlelib',

 				'orion/globalCommands', 'orion/git/gitCommands', 'orion/git/util', 'orion/Deferred' ],

-		function(messages, mSection, mExplorer, PageUtil, i18nUtil, lib, mGlobalCommands, mGitCommands, mGitUtil, Deferred) {

+		function(require, messages, mSection, mExplorer, PageUtil, i18nUtil, lib, mGlobalCommands, mGitCommands, mGitUtil, Deferred) {

 			var exports = {};

 

 			exports.GitCommitExplorer = (function() {

@@ -132,7 +132,7 @@
 					target : commit,

 					breadcrumbTarget : item,

 					makeBreadcrumbLink : function(seg, location) {

-						seg.href = "/git/git-repository.html#" + (location ? location : ""); //$NON-NLS-0$

+						seg.href = require.toUrl("git/git-repository.html") + (location ? "#" + location : ""); //$NON-NLS-0$

 					},

 					serviceRegistry : that.registry,

 					commandService : that.commandService

@@ -189,7 +189,7 @@
 						parentCommitName.style.paddingBottom = "15px";

 						var parentCommitLink = document.createElement("a");

 						parentCommitLink.className = "pnavlinkonpage";

-						parentCommitLink.href = "/git/git-commit.html#" + commit.Parents[0].Location + "?page=1&pageSize=1";

+						parentCommitLink.href = require.toUrl("git/git-commit.html#") + commit.Parents[0].Location + "?page=1&pageSize=1";

 						parentCommitLink.textContent = i18nUtil.formatMessage(messages["parent: 0"], commit.Parents[0].Name);

 						parentCommitName.appendChild(parentCommitLink);

 						detailsView.appendChild(parentCommitName);

diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitLogExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitLogExplorer.js
index 44296c9..abc8e25 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitLogExplorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitLogExplorer.js
@@ -424,7 +424,7 @@
 
 					var titleLink = document.createElement("a");
 					titleLink.className = "navlinkonpage";
-					titleLink.href = "/git/git-commit.html#" + commit.Location + "?page=1&pageSize=1";
+					titleLink.href = require.toUrl("git/git-commit.html#") + commit.Location + "?page=1&pageSize=1";
 					titleLink.textContent = commit.Message;
 					detailsView.appendChild(titleLink);
 					
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitRepositoryExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitRepositoryExplorer.js
index 49f0eb7..517a707 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitRepositoryExplorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitRepositoryExplorer.js
@@ -241,7 +241,7 @@
 		updatePageActions(that.registry, that.commandService, "pageActions", scopeId, repository || {}); //$NON-NLS-1$ //$NON-NLS-0$
 		mGlobalCommands.setPageTarget({task: "Repositories", target: repository, breadcrumbTarget: item,
 			makeBreadcrumbLink: function(seg, location) {
-				seg.href = "/git/git-repository.html#" + (location ? location : ""); //$NON-NLS-0$
+				seg.href = require.toUrl("git/git-repository.html") + (location ? "#" + location : ""); //$NON-NLS-0$
 			},
 			serviceRegistry: this.registry, commandService: this.commandService}); 
 	};
@@ -250,9 +250,7 @@
 	
 	GitRepositoryExplorer.prototype.decorateRepository = function(repository, mode, deferred){
 		var that = this;
-		if (deferred == null){
-			deferred = new Deferred();
-		}
+		deferred = deferred || new Deferred();
 		
 		if(!mode){
 			mode = "full";
@@ -412,7 +410,7 @@
 
 				if (links){
 					var link = document.createElement("a");
-					link.href = "/git/git-repository.html#" + repositories[i].Location;
+					link.href = require.toUrl("git/git-repository.html#") + repositories[i].Location;
 					link.appendChild(document.createTextNode(repositories[i].Name));
 					title.appendChild(link);
 				} else { 
@@ -426,7 +424,7 @@
 				detailsView.appendChild(div);
 				
 				var span = document.createElement("span");
-				span.textContent = (repositories[i].GitUrl != null ? "git url: " + repositories[i].GitUrl : messages["(no remote)"]);
+				span.textContent = (repositories[i].GitUrl !== null ? "git url: " + repositories[i].GitUrl : messages["(no remote)"]);
 				detailsView.appendChild(span);
 				
 				div = document.createElement("div");
@@ -516,7 +514,7 @@
 		
 		that.commandService.registerCommandContribution(titleWrapper.actionsNode.id, "eclipse.orion.git.repositories.viewAllCommand", 10); //$NON-NLS-0$
 		that.commandService.renderCommands(titleWrapper.actionsNode.id, titleWrapper.actionsNode.id, 
-			{"ViewAllLink":"/git/git-status2.html#" + repository.StatusLocation, "ViewAllLabel": messages["See Full Status"], "ViewAllTooltip": messages["See the status"]}, that, "button");
+			{"ViewAllLink":"git/git-status2.html#" + repository.StatusLocation, "ViewAllLabel": messages["See Full Status"], "ViewAllTooltip": messages["See the status"]}, that, "button");
 		
 		var progress = titleWrapper.createProgressMonitor();
 		progress.begin("Loading status"); //$NON-NLS-0$
@@ -576,8 +574,7 @@
 	
 	GitRepositoryExplorer.prototype.decorateBranches = function(branches, deferred){
 		var that = this;
-		if (deferred == null)
-			deferred = new Deferred();
+		deferred = deferred || new Deferred();
 		
 		if (branches.length > 0) {
 			this.registry.getService("orion.page.progress").progress(this.registry.getService("orion.git.provider").doGitLog(branches[0].CommitLocation + "?page=1&pageSize=1"), "Getting branch last commit " + branches[0].Name).then( //$NON-NLS-1$ //$NON-NLS-0$
@@ -623,7 +620,7 @@
 				if (mode !== "full" && branches.length !== 0){ //$NON-NLS-0$
 					that.commandService.registerCommandContribution(titleWrapper.actionsNode.id, "eclipse.orion.git.repositories.viewAllCommand", 10); //$NON-NLS-0$
 					that.commandService.renderCommands(titleWrapper.actionsNode.id, titleWrapper.actionsNode.id, 
-						{"ViewAllLink":"/git/git-repository.html#" + branchLocation + "?page=1", "ViewAllLabel":messages['View All'], "ViewAllTooltip":messages["View all local and remote tracking branches"]}, that, "button"); //$NON-NLS-7$ //$NON-NLS-5$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+						{"ViewAllLink":"git/git-repository.html#" + branchLocation + "?page=1", "ViewAllLabel":messages['View All'], "ViewAllTooltip":messages["View all local and remote tracking branches"]}, that, "button"); //$NON-NLS-7$ //$NON-NLS-5$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
 				}
 				
 				that.commandService.registerCommandContribution(titleWrapper.actionsNode.id, "eclipse.addBranch", 200); //$NON-NLS-0$
@@ -737,8 +734,7 @@
 	
 	GitRepositoryExplorer.prototype.displayRemoteBranches2 = function(titleWrapper, remotes, repository, deferred, anyRemoteBranch, previousRemoteBranches){
 		var that = this;
-		if (deferred == null)
-			deferred = new Deferred();
+		deferred = deferred || new Deferred();
 		
 		if (remotes.length > 0) {
 			this.registry.getService("orion.page.progress").progress(this.registry.getService("orion.git.provider").getGitRemote(remotes[0].Location), "Getting remote branches " + remotes[0].Name).then( //$NON-NLS-0$
@@ -838,7 +834,7 @@
 
 				that.commandService.registerCommandContribution(titleWrapper.actionsNode.id, "eclipse.orion.git.repositories.viewAllCommand", 10); //$NON-NLS-0$
 				that.commandService.renderCommands(titleWrapper.actionsNode.id, titleWrapper.actionsNode.id, 
-					{"ViewAllLink":"/git/git-log.html#" + currentBranch.CommitLocation + "?page=1", "ViewAllLabel":messages["See Full Log"], "ViewAllTooltip":messages["See the full log"]}, that, "button"); //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+					{"ViewAllLink":"git/git-log.html#" + currentBranch.CommitLocation + "?page=1", "ViewAllLabel":messages["See Full Log"], "ViewAllTooltip":messages["See the full log"]}, that, "button"); //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
 				
 				if (tracksRemoteBranch){
 					that.commandService.registerCommandContribution(titleWrapper.actionsNode.id, "eclipse.orion.git.fetch", 100); //$NON-NLS-0$
@@ -977,7 +973,7 @@
 
 		var titleLink = document.createElement("a");
 		titleLink.className = "navlinkonpage";
-		titleLink.href = "/git/git-commit.html#" + commit.Location + "?page=1&pageSize=1";
+		titleLink.href = require.toUrl("git/git-commit.html#") + commit.Location + "?page=1&pageSize=1";
 		titleLink.textContent = commit.Message;
 		detailsView.appendChild(titleLink);
 
@@ -1002,9 +998,7 @@
 	// Git tags
 	
 	GitRepositoryExplorer.prototype.decorateTag = function(tag, deferred){
-		if(deferred == null){
-			deferred = new Deferred();
-		}
+		deferred = deferred || new Deferred();
 		
 		this.registry.getService("orion.page.progress").progress(this.registry.getService("orion.git.provider").doGitLog(tag.CommitLocation + "?page=1&pageSize=1"), "Getting tag last commit " + tag.Name).then(
 			function(resp){
@@ -1067,7 +1061,7 @@
 						if (mode !== "full" && tags.length !== 0){ //$NON-NLS-0$
 							that.commandService.registerCommandContribution(titleWrapper.actionsNode.id, "eclipse.orion.git.repositories.viewAllCommand", 10); //$NON-NLS-0$
 							that.commandService.renderCommands(titleWrapper.actionsNode.id, titleWrapper.actionsNode.id,
-									{"ViewAllLink":"/git/git-repository.html#" + repository.TagLocation + "?page=1&pageSize=20", "ViewAllLabel":messages['View All'], "ViewAllTooltip":messages["View all tags"]}, that, "button"); //$NON-NLS-7$ //$NON-NLS-5$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+									{"ViewAllLink":require.toUrl("git/git-repository.html#") + repository.TagLocation + "?page=1&pageSize=20", "ViewAllLabel":messages['View All'], "ViewAllTooltip":messages["View all tags"]}, that, "button"); //$NON-NLS-7$ //$NON-NLS-5$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
 						}
 		
 						if (tags.length === 0) {
@@ -1132,7 +1126,7 @@
 		
 		var link = document.createElement("a");
 		link.className = "navlinkonpage";
-		link.href = "/git/git-commit.html#" + commit.Location + "?page=1&pageSize=1";
+		link.href = require.toUrl("git/git-commit.html#") + commit.Location + "?page=1&pageSize=1";
 		link.textContent = commit.Message;
 		description.appendChild(link);
 		
@@ -1251,7 +1245,7 @@
 
 					that.commandService.registerCommandContribution(titleWrapper.actionsNode.id, "eclipse.orion.git.repositories.viewAllCommand", 10); //$NON-NLS-0$
 					that.commandService.renderCommands(titleWrapper.actionsNode.id, titleWrapper.actionsNode.id,
-							{"ViewAllLink":"/git/git-repository.html#" + configLocation, "ViewAllLabel":messages['View All'], "ViewAllTooltip":messages["View all configuration entries"]}, that, "button"); //$NON-NLS-6$ //$NON-NLS-4$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+							{"ViewAllLink":"git/git-repository.html#" + configLocation, "ViewAllLabel":messages['View All'], "ViewAllTooltip":messages["View all configuration entries"]}, that, "button"); //$NON-NLS-6$ //$NON-NLS-4$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
 				}
 				
 				if (mode === "full"){ //$NON-NLS-0$
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitReviewRequestExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitReviewRequestExplorer.js
index c95ce92..cb00fc8 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitReviewRequestExplorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitReviewRequestExplorer.js
@@ -224,8 +224,8 @@
 								if(foundRemote){
 									findCommitLocation(repositories, sha, null, that).then(	
 										function(commitLocation){
-											var commitPageURL = "/git/git-commit.html#" + commitLocation + "?page=1&pageSize=1";
-											var repoURL = "/git/git-repository.html#" + resp.Children[0].Location;
+											var commitPageURL = require.toUrl("git/git-commit.html#") + commitLocation + "?page=1&pageSize=1";
+											var repoURL = require.toUrl("git/git-repository.html#") + resp.Children[0].Location;
 											
 											var sectionItem = document.createElement("div");
 											sectionItem.className = "sectionTableItem lightTreeTableRow";
@@ -269,7 +269,7 @@
 													index = i;
 												}
 											}
-											var repoURL = "/git/git-repository.html#" + resp.Children[0].Location;
+											var repoURL = require.toUrl("git/git-repository.html#") + resp.Children[0].Location;
 											
 											var sectionItem = document.createElement("div");
 											sectionItem.className = "sectionTableItem lightTreeTableRow";
@@ -299,7 +299,7 @@
 										}
 									);	
 								} else {
-									var repoURL = "/git/git-repository.html#" + resp.Children[0].Location;
+									var repoURL = require.toUrl("git/git-repository.html#") + resp.Children[0].Location;
 									
 									var sectionItem = document.createElement("div");
 									sectionItem.className = "sectionTableItem lightTreeTableRow";
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
index 2b78d64..b0c77b7 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
@@ -10,9 +10,9 @@
  ******************************************************************************/

 /*global define document window Image*/

 define(

-		[ 'i18n!git/nls/gitmessages', 'orion/explorers/explorer', 'orion/selection', 'orion/section', 'orion/PageUtil', 'orion/webui/littlelib',

+		[ 'require', 'i18n!git/nls/gitmessages', 'orion/explorers/explorer', 'orion/selection', 'orion/section', 'orion/PageUtil', 'orion/webui/littlelib',

 				'orion/i18nUtil', 'orion/globalCommands', 'orion/git/util',	'orion/git/gitCommands', 'orion/Deferred', 'orion/git/widgets/CommitTooltipDialog'],

-		function(messages, mExplorer, mSelection, mSection, PageUtil, lib, i18nUtil, mGlobalCommands, mGitUtil, mGitCommands,

+		function(require, messages, mExplorer, mSelection, mSection, PageUtil, lib, i18nUtil, mGlobalCommands, mGitUtil, mGitCommands,

 				Deferred, mCommitTooltip) {

 

 			var exports = {};

@@ -259,7 +259,7 @@
 					target : repository,

 					breadcrumbTarget : item,

 					makeBreadcrumbLink : function(seg, location) {

-						seg.href = "/git/git-repository.html#" + (location ? location : ""); //$NON-NLS-0$

+						seg.href = require.toUrl("git/git-repository.html") + (location ? "#" + location : ""); //$NON-NLS-0$

 					},

 					serviceRegistry : this.registry,

 					commandService : this.commandService

@@ -778,7 +778,7 @@
 														titleWrapper.actionsNode.id,

 														titleWrapper.actionsNode.id,

 														{

-															"ViewAllLink" : "/git/git-log.html#" + currentBranch.CommitLocation + "?page=1", "ViewAllLabel" : messages['See Full Log'], "ViewAllTooltip" : messages["See the full log"]}, that, "button"); //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$

+															"ViewAllLink" : require.toUrl("git/git-log.html#") + currentBranch.CommitLocation + "?page=1", "ViewAllLabel" : messages['See Full Log'], "ViewAllTooltip" : messages["See the full log"]}, that, "button"); //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$

 

 										if (tracksRemoteBranch) {

 											that.commandService.registerCommandContribution(titleWrapper.actionsNode.id, "eclipse.orion.git.fetch", 100); //$NON-NLS-0$

@@ -917,7 +917,7 @@
 

 					var titleLink = document.createElement("a");

 					titleLink.className = "navlinkonpage";

-					titleLink.href = "/git/git-commit.html#" + commit.Location + "?page=1&pageSize=1";

+					titleLink.href = require.toUrl("git/git-commit.html#") + commit.Location + "?page=1&pageSize=1";

 					titleLink.textContent = commit.Message;

 					detailsView.appendChild(titleLink);

 

diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/CommitTooltipDialog.js b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/CommitTooltipDialog.js
index 18986f3..e8b3d7a 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/CommitTooltipDialog.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/CommitTooltipDialog.js
@@ -39,7 +39,7 @@
 		var commitMessage0 = commit.Message.split(/(\r?\n|$)/)[0];

 		var link = document.createElement("a");

 		link.className = "navlinkonpage";

-		link.href = "/git/git-commit.html#" + commit.Location + "?page=1&pageSize=1";

+		link.href = require.toUrl("git/git-commit.html#") + commit.Location + "?page=1&pageSize=1";

 		link.textContent = commitMessage0;

 		tableNode.appendChild(link);

 		

@@ -94,7 +94,7 @@
 			

 			var parentLink = document.createElement("a");

 			parentLink.className = "navlinkonpage";

-			parentLink.href = "/git/git-commit.html#" + commit.Parents[0].Location + "?page=1&pageSize=1";

+			parentLink.href = require.toUrl("git/git-commit.html#") + commit.Parents[0].Location + "?page=1&pageSize=1";

 			parentLink.textContent = commit.Parents[0].Name;

 			parentNode.appendChild(parentLink);

 			

diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/OpenCommitDialog.js b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/OpenCommitDialog.js
index 9670c9f..fcaa916 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/OpenCommitDialog.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/OpenCommitDialog.js
@@ -10,8 +10,7 @@
  ******************************************************************************/
 /*globals define document clearTimeout setTimeout window Image*/
 
-define(['i18n!git/nls/gitmessages', 'orion/i18nUtil', 'orion/Deferred', 'orion/webui/dialog', 'orion/webui/littlelib'], function(
-messages, i18nUtil, Deferred, dialog, lib) {
+define(['require', 'i18n!git/nls/gitmessages', 'orion/i18nUtil', 'orion/Deferred', 'orion/webui/dialog', 'orion/webui/littlelib'], function(require, messages, i18nUtil, Deferred, dialog, lib) {
 
 	/**
 	 * Usage:
@@ -168,7 +167,7 @@
 		var commitMessage0 = commit.Message.split(/(\r?\n|$)/)[0];
 		var link = document.createElement("a");
 		link.className = "navlinkonpage";
-		link.href = "/git/git-commit.html#" + commit.Location + "?page=1&pageSize=1";
+		link.href = require.toUrl("git/git-commit.html#") + commit.Location + "?page=1&pageSize=1";
 		link.textContent = commitMessage0;
 		tableNode.appendChild(link);
 		
@@ -235,7 +234,7 @@
 			
 			var parentLink = document.createElement("a");
 			parentLink.className = "navlinkonpage";
-			parentLink.href = "/git/git-commit.html#" + commit.Parents[0].Location + "?page=1&pageSize=1";
+			parentLink.href = require.toUrl("git/git-commit.html#") + commit.Parents[0].Location + "?page=1&pageSize=1";
 			parentLink.textContent = commit.Parents[0].Name;
 			parentNode.appendChild(parentLink);
 			
diff --git a/bundles/org.eclipse.orion.client.ui/web/mixloginstatic/LoginWindow.js b/bundles/org.eclipse.orion.client.ui/web/mixloginstatic/LoginWindow.js
index 385c7a5..bad3143 100644
--- a/bundles/org.eclipse.orion.client.ui/web/mixloginstatic/LoginWindow.js
+++ b/bundles/org.eclipse.orion.client.ui/web/mixloginstatic/LoginWindow.js
@@ -419,7 +419,7 @@
 		checkemailrequest.setRequestHeader("Orion-Version", "1");
 		checkemailrequest.send();
 
-		xhr("GET", "/server-status.json", { //$NON-NLS-0$
+		xhr("GET", "../server-status.json", { //$NON-NLS-0$
 			timeout: 15000
 		}).then(function(result) {
 			var results = JSON.parse(result.response);
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js b/bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js
index e78cc8b..8bb48e6 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js
@@ -8,7 +8,7 @@
  * 

  * Contributors: IBM Corporation - initial API and implementation

  ******************************************************************************/

- define(['orion/webui/littlelib', 'orion/webui/tooltip'], function(lib, mTooltip){

+ define(['require', 'orion/webui/littlelib', 'orion/webui/tooltip'], function(require, lib, mTooltip){

  

 	/**

 	* Progress indicator in form of a simple spinner.

@@ -37,7 +37,7 @@
 		start: function(){

 			var image = document.createElement("img");

 			image.id = this._prefix+this._id;

-			image.src = "/images/none.png";

+			image.src = require.toUrl("images/none.png");

 			image.className = "progressPane_running";

 			this._anchor.appendChild(image);

 		},

@@ -46,7 +46,7 @@
 		* [interface] stops the progress indicator

 		*/

 		stop: function(){

-			var indicator = lib.node(this._prefix+this._id)

+			var indicator = lib.node(this._prefix+this._id);

 			indicator.parentNode.removeChild(indicator);

 		},

 		

@@ -55,7 +55,7 @@
 		*/

 		error: function(err){

 			var indicator = lib.node(this._prefix+this._id);

-			indicator.src = "/images/problem.gif";

+			indicator.src = require.toUrl("images/problem.gif");

 			indicator.className = "";

 			

 			new mTooltip.Tooltip({

@@ -104,7 +104,7 @@
 		* [interface] stops the progress indicator

 		*/

 		stop: function(){

-			var indicator = lib.node(this._prefix+this._id)

+			var indicator = lib.node(this._prefix+this._id);

 			indicator.parentNode.removeChild(indicator);

 		},

 		

@@ -112,11 +112,11 @@
 		* [interface] renders the progress indicator after an population error

 		*/

 		error: function(err){

-			var indicator = lib.node(this._prefix+this._id)

+			var indicator = lib.node(this._prefix+this._id);

 			indicator.parentNode.removeChild(indicator);

 			

 			var image = document.createElement("img");

-			image.src = "/images/problem.gif";

+			image.src = require.toUrl("images/problem.gif");

 			this._anchor.appendChild(image);

 			

 			new mTooltip.Tooltip({

diff --git a/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js b/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js
index b42d844..30d0e4a 100644
--- a/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js
+++ b/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js
@@ -525,7 +525,7 @@
 		 */
 		search: function(searchParams) {
 			var query = _generateLuceneQuery(searchParams);
-			return xhr("GET", "/filesearch" + query, {
+			return xhr("GET", "../filesearch" + query, {
 				headers: {
 					"Accept": "application/json",
 					"Orion-Version": "1"
diff --git a/bundles/org.eclipse.orion.client.ui/web/shell/shellPage.js b/bundles/org.eclipse.orion.client.ui/web/shell/shellPage.js
index af49d99..391d9df 100644
--- a/bundles/org.eclipse.orion.client.ui/web/shell/shellPage.js
+++ b/bundles/org.eclipse.orion.client.ui/web/shell/shellPage.js
@@ -10,24 +10,24 @@
  *     Kris De Volder (VMWare) - initial API and implementation

  *******************************************************************************/

 

-/*global define window*/

+/*global define window URL*/

 /*jslint browser:true sub:true*/

 

-define(["i18n!orion/shell/nls/messages", "orion/bootstrap", "orion/commandRegistry", "orion/fileClient", "orion/searchClient", "orion/globalCommands",

+define(["require", "i18n!orion/shell/nls/messages", "orion/bootstrap", "orion/commandRegistry", "orion/fileClient", "orion/searchClient", "orion/globalCommands",

 		"orion/widgets/Shell", "orion/webui/treetable", "shell/shellPageFileService", "shell/paramType-file", "shell/paramType-plugin", "shell/paramType-service",

 		"orion/i18nUtil", "shell/extensionCommands", "orion/contentTypes", "orion/pluginregistry", "orion/PageUtil", "orion/URITemplate", "orion/Deferred",

-		"orion/status", "orion/progress", "orion/operationsClient", "shell/resultWriters"],

-	function(messages, mBootstrap, mCommandRegistry, mFileClient, mSearchClient, mGlobalCommands, mShell, mTreeTable, mShellPageFileService, mFileParamType,

+		"orion/status", "orion/progress", "orion/operationsClient", "shell/resultWriters", "orion/URL-shim"],

+	function(require, messages, mBootstrap, mCommandRegistry, mFileClient, mSearchClient, mGlobalCommands, mShell, mTreeTable, mShellPageFileService, mFileParamType,

 		mPluginParamType, mServiceParamType, i18nUtil, mExtensionCommands, mContentTypes, mPluginRegistry, PageUtil, URITemplate, Deferred, mStatus, mProgress,

-		mOperationsClient, mResultWriters) {

+		mOperationsClient, mResultWriters, _) {

 

 	var shellPageFileService, fileClient, output, fileType;

 	var hashUpdated = false;

 	var contentTypeService, openWithCommands = [], serviceRegistry;

 	var pluginRegistry, pluginType, preferences, serviceElementCounter = 0;

 

-	var ROOT_ORIONCONTENT = "/file"; //$NON-NLS-0$

-	var PAGE_TEMPLATE = "{OrionHome}/shell/shellPage.html#{,resource}"; //$NON-NLS-0$

+	var ROOT_ORIONCONTENT = new URL(require.toUrl("file"), window.location.href).pathname; //$NON-NLS-0$

+	var PAGE_TEMPLATE = require.toUrl("shell/shellPage.html") + "#{,resource}"; //$NON-NLS-0$

 

 	var CommandResult = (function() {

 		function CommandResult(value, type) {

diff --git a/bundles/org.eclipse.orion.client.ui/web/sites/site.js b/bundles/org.eclipse.orion.client.ui/web/sites/site.js
index 48c62a1..87c162d 100644
--- a/bundles/org.eclipse.orion.client.ui/web/sites/site.js
+++ b/bundles/org.eclipse.orion.client.ui/web/sites/site.js
@@ -15,10 +15,10 @@
 /*
  * Glue code for site.html
  */
-define(['i18n!orion/sites/nls/messages', 'orion/bootstrap', 'orion/status', 'orion/progress', 'orion/commandRegistry', 
+define(['require', 'i18n!orion/sites/nls/messages', 'orion/bootstrap', 'orion/status', 'orion/progress', 'orion/commandRegistry', 
 	'orion/fileClient', 'orion/operationsClient', 'orion/searchClient', 'orion/dialogs', 'orion/globalCommands', 'orion/sites/siteClient', 'orion/sites/siteCommands',
 	'orion/PageUtil', 'orion/sites/SiteEditor'], 
-	function(messages,mBootstrap, mStatus, mProgress, mCommandRegistry, mFileClient, mOperationsClient, mSearchClient, mDialogs, mGlobalCommands, mSiteClient, mSiteCommands, PageUtil, SiteEditor) {
+	function(require, messages,mBootstrap, mStatus, mProgress, mCommandRegistry, mFileClient, mOperationsClient, mSearchClient, mDialogs, mGlobalCommands, mSiteClient, mSiteCommands, PageUtil, SiteEditor) {
 		mBootstrap.startup().then(function(core) {
 			var serviceRegistry = core.serviceRegistry;
 			var preferences = core.preferences;
@@ -47,7 +47,7 @@
 					item.Parents[0].Location = "";
 					mGlobalCommands.setPageTarget({task: "Edit Site", target: site, breadcrumbTarget: item,
 						makeBreadcrumbLink: function(seg, location){
-							seg.href = "/sites/sites.html"; //$NON-NLS-0$
+							seg.href = require.toUrl("sites/sites.html"); //$NON-NLS-0$
 						},
 						serviceRegistry: serviceRegistry, searchService: searcher, fileService: fileClient, commandService: commandRegistry
 					});