class RewriteConfig implements RewriteRule {

    @Override
    public Optional<String> rewrite(String originalUri) {
        Matcher matcher = compiledUrlPattern.matcher(originalUri);
        if (matcher.matches()) {
            return Optional.of(preprocessedReplacement.substitute(matcher));
        }

        return Optional.empty();
    }

    public  RewriteConfig(String urlPattern, String replacement);

}