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

com.vtence.molecule.http.Cookie Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
package com.vtence.molecule.http;

public class Cookie {
    private final String name;

    private String value;
    private boolean httpOnly;
    private int maxAge = -1;

    public Cookie(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public String name() {
        return name;
    }

    public String value() {
        return value;
    }

    public boolean httpOnly() {
        return httpOnly;
    }

    public Cookie httpOnly(boolean httpOnly) {
        this.httpOnly = httpOnly;
        return this;
    }

    public Cookie maxAge(int maxAge) {
        this.maxAge = maxAge;
        return this;
    }

    public int maxAge() {
        return maxAge;
    }

    public String toString() {
        return name + "=" + value +
                (maxAge >= 0 ? "Max-Age=" + maxAge : "") +
                (httpOnly ? "; HttpOnly" : "");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy