public interface Cookie
extends org.refcodes.structure.Property.PropertyBuilder
Cookie
represents a HTTP cookie. As the cookies differ between an
HTTP-Request and an HTTP-Response, we have the sub-interfaces
RequestCookie
and ResponseCookie
.
As of "HTTP cookies explained - NCZOnline": "... There is some confusion over
encoding of a cookie value. The commonly held belief is that cookie values
must be URL-encoded, but this is a fallacy even though it is the de facto
implementation. The original specification indicates that only three types of
characters must be encoded: semicolon, comma, and white space. The
specification indicates that URL encoding may be used but stops short of
requiring it. The RFC makes no mention of encoding whatsoever. Still, almost
all implementations perform some sort of URL encoding on cookie values. In
the case of name=value formats, the name and value are typically encoded
separately while the equals sign is left as is. ..."
Therefore we use URL encoding / decoding for the cookie value (regarding
fromHttpCookie(String)
and toHttpCookie()
) to make life
easier and not fall into the trap of unescaped values.org.refcodes.structure.Property.PropertyBuilder
org.refcodes.structure.Relation.RelationBuilder<K,V>
Modifier and Type | Method and Description |
---|---|
void |
fromHttpCookie(String aHttpCookie)
Sets the cookie according to the provided HTTP cookie text.
|
String |
toHttpCookie()
Returns the cookie to be assigned to a cookie Header-Field.
|
Cookie |
withHttpCookie(String aHttpCookie)
Sets the cookie according to the provided HTTP cookie text via
fromHttpCookie(String) . |
String toHttpCookie()
Cookie withHttpCookie(String aHttpCookie)
fromHttpCookie(String)
.aHttpCookie
- The HTTP cookie text.Cookie
instance as of the Builder-Pattern.void fromHttpCookie(String aHttpCookie)
aHttpCookie
- The HTTP cookie text.Copyright © 2018. All rights reserved.