@SneakyThrows(URISyntaxException.class)
    private static URI overrideSavedRequestURI(URI savedRequestURI) {
        if (RESUBMIT_HOST.isPresent() || RESUBMIT_PORT.isPresent()) {
            var uri = new URI(savedRequestURI.getScheme(), savedRequestURI.getRawUserInfo(),
                    RESUBMIT_HOST.orElse(savedRequestURI.getHost()), RESUBMIT_PORT.orElse(savedRequestURI.getPort()),
                    savedRequestURI.getRawPath(), savedRequestURI.getRawQuery(), savedRequestURI.getRawFragment());
            log.debug("Form Resubmit - Overriding URI {} with {}", savedRequestURI, uri);
            return uri;
        } else {
            return savedRequestURI;
        }
    }
flash cookie is preserved here

@param request
@param response
@param path
@param paramValues
support/jakarta-ee/src/main/java/org/apache/shiro/ee/filters/FormResubmitSupport.java