All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dreamhead.moco.util.Cookies Maven / Gradle / Ivy

Go to download

Moco is an easy setup stub framework, mainly focusing on testing and integration.

There is a newer version: 1.5.0
Show newest version
package com.github.dreamhead.moco.util;

import com.github.dreamhead.moco.CookieAttribute;
import com.github.dreamhead.moco.cookie.ActualCookieAttribute;
import io.netty.handler.codec.http.cookie.ServerCookieEncoder;
import io.netty.handler.codec.http.cookie.Cookie;
import io.netty.handler.codec.http.cookie.DefaultCookie;

public final class Cookies {
    public String encodeCookie(final String key, final String value, final CookieAttribute... options) {
        Cookie cookie = new DefaultCookie(key, value);
        for (CookieAttribute option : options) {
            ((ActualCookieAttribute) option).visit(cookie);
        }
        return ServerCookieEncoder.STRICT.encode(cookie);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy