RhttpdApp-class | R Documentation |
RhttpdApp
Creates a Rook application ready to add to an Rhttpd
server.
The internal web server allows dispatching to user-defined closures located in tools:::.httpd.handlers.env. For instance, if a handler named 'foo' is placed there, then the url path to that handler is /custom/foo.
RhttpdApp
along with Rhttpd
hide these details by
allowing a user to create application objects specifying only their name
and the application. There is currently a limit of 63 characters
or less for application names.
NOTE: When a file is given as the value of the app
argument
to new()
, it is monitored for timestamp changes. If a change
occurs in the modification time as returned by file.info
,
then the file is sourced prior to handling subsequent requests.
new(app, name)
: Creates an object of class RhttpdApp
. Argument app
can be any Rook
aware object or it can be a location to a file whose source creates a Rook aware object. That object must be named either 'app'
or the value of name
. name
is a character vector.
Rhttpd
.
s <- Rhttpd$new() s$add(RhttpdApp$new( name='summary', app=system.file('exampleApps/summary.R',package='Rook') )) ## Not run: s$start(quiet=TRUE) s$browse(1) ## End(Not run) s$remove(all=TRUE) # Stops the server but doesn't uninstall the app ## Not run: s$stop() ## End(Not run) s$remove(all=TRUE) rm(s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.