Created
October 5, 2014 22:58
-
-
Save cemartins/bd17fce7d003a7536663 to your computer and use it in GitHub Desktop.
Method to calculate the server address based on the server-url parameter in the JNLP file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private URI getServerEndpointAddress() { | |
String serverEndpointStr = SERVER_URL; | |
Parameters parameters = getParameters(); | |
if(parameters != null && parameters.getNamed().get("server-url") != null) { | |
serverEndpointStr = parameters.getNamed().get("server-url"); | |
if(serverEndpointStr.startsWith("https")) | |
serverEndpointStr = serverEndpointStr.replaceFirst("https", "wss"); | |
else | |
serverEndpointStr = serverEndpointStr.replaceFirst("http", "ws"); | |
serverEndpointStr = serverEndpointStr + "/wstest"; | |
logger.debug("Calculated Server Endpoint Address: " + serverEndpointStr); | |
} | |
return URI.create(serverEndpointStr); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment