RhttpdApp-class {Rook} | R Documentation |
Class RhttpdApp
Description
Creates a Rook application ready to add to an Rhttpd
server.
Details
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.
Methods
new(app, name)
:Creates an object of class
RhttpdApp
. Argumentapp
can be anyRook
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 ofname
.name
is a character vector.
See Also
Examples
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)