![JAR search and dependency download from the Maven repository](/logo.png)
org.bitbucket.gkutiel.in.my.mind.feature.Cookies Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of in-my-mind Show documentation
Show all versions of in-my-mind Show documentation
An opinionated web framework on top of in-core
The newest version!
package org.bitbucket.gkutiel.in.my.mind.feature;
import static java.util.concurrent.TimeUnit.DAYS;
import org.bitbucket.gkutiel.in.Feature;
import com.google.gson.Gson;
import io.netty.handler.codec.http.DefaultCookie;
@SuppressWarnings("deprecation")
public interface Cookies extends Jwt, Feature {
static final Gson gson = new Gson();
default void delCookie(final String name) {
final DefaultCookie cookie = new DefaultCookie(name, "");
cookie.setMaxAge(0);
res().addCookie(cookie);
}
default void setCookie(final String key, final T val) {
final DefaultCookie cookie = new DefaultCookie(key, encode(gson.toJson(val)));
cookie.setMaxAge(DAYS.toSeconds(365));
res().addCookie(cookie);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy