Package org.takes.facets.cookies
Class RsWithCookie
- java.lang.Object
-
- org.takes.rs.RsWrap
-
- org.takes.facets.cookies.RsWithCookie
-
public final class RsWithCookie extends RsWrap
Response decorator, with an additional cookie. The decorator validates cookie name according to RFC 2616 and cookie value according to RFC 6265Use this decorator in order to return a response with a "Set-Cookie" header inside, for example:
return new RsWithCookie( new RsText("hello, world!"), "u", "Jeff", "Path=/", "Expires=Wed, 13 Jan 2021 22:23:01 GMT" );
This response will contain this header:
Set-Cookie: u=Jeff;Path=/;Expires=Wed, 13 Jan 2021 22:23:01 GMT
The class is immutable and thread-safe.
- Since:
- 0.1
-
-
Constructor Summary
Constructors Constructor Description RsWithCookie(CharSequence name, CharSequence value, CharSequence... attrs)
Ctor.RsWithCookie(Response res, CharSequence name, CharSequence value, CharSequence... attrs)
Ctor.
-
-
-
Constructor Detail
-
RsWithCookie
public RsWithCookie(CharSequence name, CharSequence value, CharSequence... attrs)
Ctor.- Parameters:
name
- Cookie namevalue
- Value of itattrs
- Optional attributes, for example "Path=/"
-
RsWithCookie
public RsWithCookie(Response res, CharSequence name, CharSequence value, CharSequence... attrs)
Ctor.- Parameters:
res
- Original responsename
- Cookie namevalue
- Value of itattrs
- Optional attributes, for example "Path=/"
-
-