Package net.officefloor.server.http
Class WritableHttpCookie
java.lang.Object
net.officefloor.server.http.WritableHttpCookie
- All Implemented Interfaces:
HttpResponseCookie
Writable HTTP Cookie.
- Author:
- Daniel Sagenschneider
-
Field Summary
FieldsModifier and TypeFieldDescriptionNextWritableHttpCookieto enable chaining together into linked list.Fields inherited from interface net.officefloor.server.http.HttpResponseCookie
BROWSER_SESSION_MAX_AGE -
Constructor Summary
ConstructorsConstructorDescriptionWritableHttpCookie(String name, String value, ManagedObjectContext context) Instantiate. -
Method Summary
Modifier and TypeMethodDescriptionaddExtension(String extension) Allows adding an extension.Clears the attributes.configure(Consumer<HttpResponseCookie> configurer) Enables configuring multiple attributes with reduced locking.Obtains the domain.Obtains the expire time.String[]Obtains the extensions.longObtains the maximum age in seconds.getName()Obtains the name.getPath()Obtains the path.getValue()Obtains the value.booleanIndicates if the Cookie is only sent over HTTP connection.booleanisSecure()Indicates if only communicated across secure a secure connection.Specifies the domain.setExpires(TemporalAccessor expires) Sets the expire time.setHttpOnly(boolean isHttpOnly) Indicates if only available over HTTP requests (and not, for example, made available to JavaScript in the browser).setMaxAge(long maxAge) Sets the maximum age in seconds.Specifies the path.setSecure(boolean isSecure) Flags whether the client is only to send the Cookie over a secure connection.Sets the value.Obtains the HTTP Cookie value for the HTTP response.<B> voidwrite(StreamBuffer<B> head, StreamBufferPool<B> bufferPool) Writes this HTTP Cookie to theStreamBufferstream.
-
Field Details
-
next
NextWritableHttpCookieto enable chaining together into linked list.
-
-
Constructor Details
-
WritableHttpCookie
Instantiate.- Parameters:
name- Name.value- Value.context-ManagedObjectContext.
-
-
Method Details
-
write
Writes this HTTP Cookie to theStreamBufferstream.- Type Parameters:
B- Buffer type.- Parameters:
head- HeadStreamBufferof linked list ofStreamBufferinstances.bufferPool-StreamBufferPool.
-
toResponseHeaderValue
Obtains the HTTP Cookie value for the HTTP response.- Returns:
- HTTP header value.
-
getName
Description copied from interface:HttpResponseCookieObtains the name.- Specified by:
getNamein interfaceHttpResponseCookie- Returns:
- Name.
-
getValue
Description copied from interface:HttpResponseCookieObtains the value.- Specified by:
getValuein interfaceHttpResponseCookie- Returns:
- Value.
-
setValue
Description copied from interface:HttpResponseCookieSets the value.- Specified by:
setValuein interfaceHttpResponseCookie- Parameters:
value- Value.- Returns:
- this.
-
getExpires
Description copied from interface:HttpResponseCookieObtains the expire time.- Specified by:
getExpiresin interfaceHttpResponseCookie- Returns:
- Expire time. May be
nullif no expire.
-
setExpires
Description copied from interface:HttpResponseCookieSets the expire time.- Specified by:
setExpiresin interfaceHttpResponseCookie- Parameters:
expires- Expires time.- Returns:
- this.
-
getMaxAge
public long getMaxAge()Description copied from interface:HttpResponseCookieObtains the maximum age in seconds.- Specified by:
getMaxAgein interfaceHttpResponseCookie- Returns:
- Maximum age in seconds. Will be
HttpResponseCookie.BROWSER_SESSION_MAX_AGEif not specified.
-
setMaxAge
Description copied from interface:HttpResponseCookieSets the maximum age in seconds.
As per RFC 6265 this overrides
Expires.- Specified by:
setMaxAgein interfaceHttpResponseCookie- Parameters:
maxAge- Maximum age in seconds.- Returns:
- this.
-
getDomain
Description copied from interface:HttpResponseCookieObtains the domain.- Specified by:
getDomainin interfaceHttpResponseCookie- Returns:
- Domain. May be
null.
-
setDomain
Description copied from interface:HttpResponseCookieSpecifies the domain.- Specified by:
setDomainin interfaceHttpResponseCookie- Parameters:
domain- Domain.- Returns:
- this.
-
getPath
Description copied from interface:HttpResponseCookieObtains the path.- Specified by:
getPathin interfaceHttpResponseCookie- Returns:
- Path. May be
null.
-
setPath
Description copied from interface:HttpResponseCookieSpecifies the path.- Specified by:
setPathin interfaceHttpResponseCookie- Parameters:
path- Path.- Returns:
- this.
-
isSecure
public boolean isSecure()Description copied from interface:HttpResponseCookieIndicates if only communicated across secure a secure connection.
Note that, as per RFC 6265, this does not guarantee the security of the cookie contents. Cookies, as per the specification, are inherently insecure (such as any information sent to the client).
- Specified by:
isSecurein interfaceHttpResponseCookie- Returns:
trueto only communicate this Cookie across a secure connection.
-
setSecure
Description copied from interface:HttpResponseCookieFlags whether the client is only to send the Cookie over a secure connection.- Specified by:
setSecurein interfaceHttpResponseCookie- Parameters:
isSecure-trueto request the client to only send this Cookie over a secure connection (assuming the client supports this).- Returns:
- this.
-
isHttpOnly
public boolean isHttpOnly()Description copied from interface:HttpResponseCookieIndicates if the Cookie is only sent over HTTP connection.- Specified by:
isHttpOnlyin interfaceHttpResponseCookie- Returns:
trueto only make this Cookie available in HTTP requests.
-
setHttpOnly
Description copied from interface:HttpResponseCookieIndicates if only available over HTTP requests (and not, for example, made available to JavaScript in the browser).- Specified by:
setHttpOnlyin interfaceHttpResponseCookie- Parameters:
isHttpOnly-trueto request the client to only send this Cookie in HTTP requests, and not, for example, make available to JavaScript in the browser.- Returns:
- this.
-
addExtension
Description copied from interface:HttpResponseCookieAllows adding an extension.
The extensions are added as provided (separated by ';') to the end of the
Set-CookieHttpHeader.- Specified by:
addExtensionin interfaceHttpResponseCookie- Parameters:
extension- Extension.- Returns:
- this.
-
getExtensions
Description copied from interface:HttpResponseCookieObtains the extensions.- Specified by:
getExtensionsin interfaceHttpResponseCookie- Returns:
- Extensions.
-
clearAttributes
Description copied from interface:HttpResponseCookieClears the attributes.- Specified by:
clearAttributesin interfaceHttpResponseCookie- Returns:
- this.
-
configure
Description copied from interface:HttpResponseCookieEnables configuring multiple attributes with reduced locking.- Specified by:
configurein interfaceHttpResponseCookie- Parameters:
configurer-Consumerto configured theHttpResponseCookie.- Returns:
- this.
-