Skip to content

Commit

Permalink
Server uri auto determined
Browse files Browse the repository at this point in the history
  • Loading branch information
giuseppeciulla committed Jul 19, 2018
1 parent 2e51968 commit e00bb8f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
21 changes: 0 additions & 21 deletions IdraPortal/src/main/java/it/eng/idraportal/utils/LoadConfigs.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,6 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t

json=new JSONObject(prop);

/*
* Problem with reverse proxy
* TODO: check this answer
* https://stackoverflow.com/questions/25911469/request-getscheme-is-returning-http-instead-of-returning-https-in-java
* */
// String serverUri = request.getScheme() + "://" +
// request.getServerName() +
// ("".equalsIgnoreCase(request.getServerPort()+"")?"":":" + request.getServerPort());
//
// System.out.println("\n\n\n");
// System.out.println(serverUri);
// System.out.println("\n\n\n");
// String adminURL = json.getString("ADMIN_SERVICES_BASE_URL");
// if(!adminURL.startsWith("http")) {
// json.put("ADMIN_SERVICES_BASE_URL", serverUri+(adminURL.startsWith("/")?"":"/")+adminURL);
// }
// String clientURL = json.getString("CLIENT_SERVICES_BASE_URL");
// if(!clientURL.startsWith("http")) {
// json.put("CLIENT_SERVICES_BASE_URL", serverUri+(clientURL.startsWith("/")?"":"/")+clientURL);
// }

out.write(json.toString());

}
Expand Down
7 changes: 3 additions & 4 deletions IdraPortal/src/main/resources/configuration.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
### PLATFORM APIs PATH ###############################################

# If not specified in ADMIN_SERVICES_BASE_URL and in CLIENT_SERVICES_BASE_URL
# the server uri will be automatically set by the portal (LoadConfigs servlet)
# Not working yet
# the server uri will be automatically set by the portal

ADMIN_SERVICES_BASE_URL = http://localhost:8080/Idra/api/v1/administration
CLIENT_SERVICES_BASE_URL = http://localhost:8080/Idra/api/v1/client
ADMIN_SERVICES_BASE_URL = Idra/api/v1/administration
CLIENT_SERVICES_BASE_URL = Idra/api/v1/client

#### ADMINISTRATION APIs ########################
## NODES ####
Expand Down
11 changes: 11 additions & 0 deletions IdraPortal/src/main/webapp/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
// ODMSNodesAPI.buildCache();
// }]);

app.run(['config','$location',function(config,$location) {
var adminURL = config.ADMIN_SERVICES_BASE_URL;
if(!adminURL.startsWith('http')){
config.ADMIN_SERVICES_BASE_URL=$location.protocol() + "://" + $location.host() + ":" + $location.port()+(adminURL.startsWith("/")?"":"/")+adminURL;
}
var clientURL = config.CLIENT_SERVICES_BASE_URL;
if(!config.CLIENT_SERVICES_BASE_URL.startsWith('http')){
config.CLIENT_SERVICES_BASE_URL=$location.protocol() + "://" + $location.host() + ":" + $location.port()+(clientURL.startsWith("/")?"":"/")+clientURL;
}
}]);

app.config(['uiZeroclipConfigProvider', function(uiZeroclipConfigProvider) {
uiZeroclipConfigProvider.setZcConf({
swfPath: "bower_components/zeroclipboard/dist/ZeroClipboard.swf"
Expand Down

0 comments on commit e00bb8f

Please sign in to comment.