blob: 0c0bbc8d4744c09bd9352692336447c8533dd0bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package org.gluster.storage.management.client.utils;
import java.net.URI;
import javax.ws.rs.core.UriBuilder;
import org.gluster.storage.management.client.constants.ClientConstants;
public class ClientUtil {
public static URI getServerBaseURI() {
return UriBuilder.fromUri(getBaseURL()).path(ClientConstants.REST_API_VERSION).build();
}
private static String getBaseURL() {
// remove the platform path (e.g. /linux.gtk.x86_64) from the URL
return System.getProperty(ClientConstants.SYS_PROP_SERVER_URL, ClientConstants.DEFAULT_SERVER_URL)
.replaceAll(ClientConstants.CONTEXT_ROOT + "\\/.*", ClientConstants.CONTEXT_ROOT + "\\/");
}
}
|