Class ContextToolkit
A toolkit for convenient functions to work on the context.
Defined in: ContextToolkit.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
ContextToolkit.applyCookiesToHeaders(context)
Apply the cookies, which are currently available on the context, to the
correct headers.
|
| <static> |
ContextToolkit.applyRedirect(context, path)
Redirect to a different url.
|
| <static> |
ContextToolkit.applyRequestHeaders(context, headers)
Apply the request-headers to a context.
|
| <static> |
ContextToolkit.removeCookie(context, key, path)
Remove a cookie.
|
| <static> |
ContextToolkit.setCookie(context, key, value, life_time, path)
Set a cookie.
|
Method Detail
<static>
ContextToolkit.applyCookiesToHeaders(context)
Apply the cookies, which are currently available on the context, to the
correct headers. This is usually triggered by the application, which
delivers the response for the context.
- Parameters:
- {Context} context
- The context for the operation.
<static>
ContextToolkit.applyRedirect(context, path)
Redirect to a different url.
- Parameters:
- {Context} context
- The context for the operation.
- {String} path
- The path where to redirect to.
<static>
ContextToolkit.applyRequestHeaders(context, headers)
Apply the request-headers to a context. This will for instance set the
Context#clean_cookies and Context#cookies property.
- Parameters:
- {Context} context
- The context for the operation.
- {Object} headers
- The request headers (usually taken from http.ServerRequest.headers)
<static>
ContextToolkit.removeCookie(context, key, path)
Remove a cookie. This is achieved by setting the lifetime to -1.
- Parameters:
- {Context} context
- Specifies the context to remove this cookie from.
- {String} key
- Set the key for the cookie. Must be a string.
- {String} path Optional, Default: null
- Set the path for the cookie.
<static>
ContextToolkit.setCookie(context, key, value, life_time, path)
Set a cookie.
- Parameters:
- {Context} context
- Specifies the context to set this cookie for.
- {String} key
- Set the key for the cookie. Must be a string.
- {String|Object|Array|Number} value
- Set value of the cookie. May even be an Object. Will be encoded to JSON.
- {Number} life_time Optional, Default: null
- Set the amount of seconds this cookie is meant to be alive. Can be 0 to indicate that this is set for the lifetime of the browser session only.
- {String} path Optional, Default: null
- Set the path for the cookie.