| BackendRserve {RestRserve} | R Documentation |
Creates Rserve backend for processing HTTP requests
Description
Creates BackendRserve object which can start Application using Rserve backend.
Super class
RestRserve::Backend -> BackendRserve
Methods
Public methods
Method new()
Creates BackendRserve object.
Usage
BackendRserve$new(..., jit_level = 0L, precompile = FALSE)
Arguments
...Not used at the moment.
jit_levelchanges R's byte compiler level to this value before app start.
precompiletry to use R's byte compiler to pre-compile
Method start()
Starts RestRserve application from current R session.
Usage
BackendRserve$start(app, http_port = 8080, ..., background = FALSE)
Arguments
appApplication object.
http_portHTTP port for application. Negative values (such as -1) means not to expose plain http.
...Key-value pairs of the Rserve configuration. If contains
"http.port"thenhttp_portwill be silently replaced with its value.backgroundWhether to try to launch in background process on UNIX.
Returns
ApplicationProcess object when background = TRUE.
Method set_request()
Parse request and set to it fields.
Usage
BackendRserve$set_request( request, path = "/", parameters_query = NULL, headers = NULL, body = NULL )
Arguments
requestRequest object.
pathCharacter with requested path. Always starts with
/.parameters_queryA named character vector with URL decoded query parameters.
headersRequest HTTP headers.
bodyRequest body. Can be
NULL, raw vector or named character vector for the URL encoded form (like aparameters_queryparameter).
Returns
request modified object.
Method convert_response()
Convert self object to Rserve compatible structure.
Usage
BackendRserve$convert_response(response)
Arguments
responseResponse object.
Returns
List with the following structure:
-
body: can be a character vector of length one or a raw vector. if the character vector is named "file" then the content of a file of that name is the body. If the character vector is named "tmpfile" then the content of a temporary file of that name is the body. -
content-type: must be a character vector of length one or NULL (if present, else default is"text/plain"). -
headers: must be a character vector - the elements will have CRLF appended and neitherContent-typenorContent-lengthmay be used. -
status-code: must be an integer if present (default is 200).
Method clone()
The objects of this class are cloneable with this method.
Usage
BackendRserve$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.