com.fastchar.server.undertow.CookieSameSiteHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fastchar-server-undertow Show documentation
Show all versions of fastchar-server-undertow Show documentation
FastChar-Server-Undertow is server container for undertow.
package com.fastchar.server.undertow;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.handlers.Cookie;
public class CookieSameSiteHandler implements HttpHandler {
private final FastUndertowConfig undertowConfig;
public CookieSameSiteHandler(FastUndertowConfig undertowConfig) {
this.undertowConfig = undertowConfig;
}
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
if (undertowConfig.getCookieSameSite() != null) {
exchange.addResponseCommitListener(exchange1 -> {
for (Cookie cookie : exchange1.responseCookies()) {
cookie.setSameSiteMode(undertowConfig.getCookieSameSite().attributeValue());
}
});
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy