| | |
| | | } |
| | | } |
| | | |
| | | // ======================== tools ======================== |
| | | public String buildUrl(String host, Integer port, String path) { |
| | | return buildUrl(host, port, path, false); |
| | | } |
| | | |
| | | public String buildUrl(String host, Integer port, String path, boolean ssl) { |
| | | String p = (path == null) ? "" : (path.startsWith("/") ? path : ("/" + path)); |
| | | return (ssl ? "https" : "http") + "://" + host + ":" + port + p; |
| | | } |
| | | |
| | | // ===================== Demo (main) ===================== |
| | | |
| | | public static void main(String[] args) throws Exception { |