WebResult: Result object of a FastRWeb script

Description Usage Arguments Details Value Author(s) See Also


WebResult is the class of the object that will be returned from the run function of a FastRWeb script back to the browser.

Using a separate class allows automatic conversion of other objects into the necessary representation - all that is needed is a as.WebResult method for that particular object.

WebResult function can be used to create such objects directly.

as.WebResult coerces an object into a WebResult, it is a generic. This allows methods to be defined for as.WebResult which act as convertors transforming R objects into web results.


WebResult(cmd = "html", payload = "", content.type = "text/html; charset=utf-8",
          headers = character(0))
as.WebResult(x, ...)



string, command passed back to the FastRWeb interface. Currently supported commands are "html", "file", "tmpfile" and "raw". See details below.


string, the body (contents) that will be sent back or file name, depending on the command


MIME content type specification as it will be returned to the browser


string vector, optional additional headers to be sent to the browser. Must not contain CR or LF!


object to convert into WebResult


additional arguments passed to the method


There are four ways the results can be passed from R to the client (browser):

All modes except "raw" cause FastRWeb to generate HTML headers based on the content and any custom headers that were added using add.header or the headers argument. Note that the latter two may NOT contain Content-length: and Content-type: entries as those are generated automatically based on the content and the content.type argument.


Object of the class WebResult


Simon Urbanek

See Also

add.header, done

FastRWeb documentation built on May 2, 2019, 2:16 a.m.