This commit is contained in:
Rinjae
2025-09-05 18:57:45 +09:00
commit aacc1a389e
1229 changed files with 167963 additions and 0 deletions
@@ -0,0 +1,27 @@
package com.eactive.eai.util;
import java.net.MalformedURLException;
import java.net.URL;
public class UrlUtil {
public static String replaceIpAddress(String httpUrl, String newIp, String newPort) {
try {
URL url = new URL(httpUrl);
String host = url.getHost();
int port = url.getPort();
String newUrl = "";
if (port == -1) {
newUrl = httpUrl.replace(host, newIp + ":" + newPort);
} else {
newUrl = httpUrl.replace(host + ":" + port, newIp + ":" + newPort);
}
return newUrl;
} catch (MalformedURLException e) {
return httpUrl;
}
}
// public static void main(String[] args) throws Exception {
// System.out.println(
// replaceIpAddress("http://i-ada.postbank.go.kr:123/web/jmd/ONL/EAI/abcd", "192.168.0.1", "5555"));
// }
}