class AppUtils {

    public String getReturnUrl(final String url, final String fallback) {
        if (url == null || url.isBlank()) {
            return fallback;
        }

        try {
            final URI uri = new URI(url);
            if (uri.isAbsolute()) {
                return fallback;
            }

            return url;
        }
        catch (final URISyntaxException ex) {
            return fallback;
        }
    }

}