2024-05-25 18:19:03 +02:00
|
|
|
package stirling.software.SPDF.utils;
|
|
|
|
|
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
public class UrlUtils {
|
|
|
|
|
2024-06-09 13:56:55 +01:00
|
|
|
private UrlUtils() {}
|
2024-06-07 07:52:26 +00:00
|
|
|
|
2024-05-25 18:19:03 +02:00
|
|
|
public static String getOrigin(HttpServletRequest request) {
|
|
|
|
String scheme = request.getScheme(); // http or https
|
|
|
|
String serverName = request.getServerName(); // localhost
|
|
|
|
int serverPort = request.getServerPort(); // 8080
|
|
|
|
String contextPath = request.getContextPath(); // /myapp
|
|
|
|
|
|
|
|
return scheme + "://" + serverName + ":" + serverPort + contextPath;
|
|
|
|
}
|
|
|
|
}
|