Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
542 B
Java
Raw Normal View History

2024-05-25 18:19:03 +02:00
package stirling.software.SPDF.utils;
import jakarta.servlet.http.HttpServletRequest;
public class UrlUtils {
private UrlUtils() {}
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;
}
}