| Utils-class {Rook} | R Documentation |
Class Utils
Description
A convenience object for working with various aspects of web requests and responses.
Methods
bytesize(string=NULL):Returns size in bytes for
string, a character vector.unescape(s=NULL):returns the url decoded value of the character vector
s. Also replaces the'+'character with a space.status_code(status=NULL):returns integer value for the given HTTP
status, which can either be numeric or or a character vector describing the status. Returnsas.integer(500)ifstatusis NULL.escape_html(string=NULL):replaces
"&","<",">","'", and'"'with entity equivalents.raw.match(needle=NULL, haystack=NULL, all=TRUE):returns index position of
needleinhaystack. All matched indexes are returned by default.needleis either a raw vector or character string.haystackis a raw vector.parse_query(qs=NULL, d=DEFAULT_SEP):Creates a named list from the the query string
qs.dis the separator value and defaults to'[&;] *'.rfc2822(ts=NULL):Formats
tsin RFC2822 time.tsmust be aPOSIXtobject.escape(s=NULL):Transforms any non-printable characters found in
sto their percent-encoded equivalents.build_query(params=NULL):Creates a query string from the named list given in
params.timezero():Returns a
POSIXctobject set to UNIX epoch.set_cookie_header(header, key, value, expires, path, domain, secure, httpOnly):Sets an HTTP cookie header in the environment
header. All arguments exceptexpiresare length 1 character vectors, whileexpiresmust be aPOSIXctobject.delete_cookie_header(header, key, value, expires, path, domain, secure, httpOnly):Deletes the HTTP cookie header.
See Also
Examples
Utils$bytesize('foo')
Utils$escape('foo bar')
Utils$unescape('foo+bar')
Utils$escape_html('foo <bar>')
Utils$escape('foo <bar>')
Utils$escape('foo\n<bar>')
Utils$status_code('OK')
Utils$status_code('Found')
Utils$status_code('Not Found')
x <- Utils$parse_query('foo=1&bar=baz')
x
Utils$rfc2822(Sys.time())
Utils$timezero()
Utils$build_query(x)
rm(x)