new.FastRWeb.analysis.page.run(app, FastRWeb.scriptname, FastRWeb.prefix = "/cgi-bin/R", APS.resources.location = "/R", front.end.location = "/dist-aps", front.end.dir = system.file("htdocs/client/dist-aps", package = "AnalysisPageServer"), tmpdir = tempdir(), FastRWeb.tmpdir = getwd(), referer = "", EP = NULL, REST.location = "/REST", verbose = FALSE, logger = create.logger(stderr(), if (verbose) log4r:::INFO else log4r:::FATAL), ...)
...
).FastRWeb.R
would be
created, and the URL would be FastRWeb.prefix/FastRWeb.scriptname
.FastRWeb.scriptname
for APS
and front.end.location
for client
).analysis
, pages
, and other details
that normal users don't have to worry about). Default, "R", is probably fine.system.file("htdocs", package = 'AnalysisPageServer')
tempdir()
.
This is ignored if app
is an AnalysisPageRApacheApp
. This is a directory private (in the OOP sense,
not necessarily in the filesystem sense of the word "private") to the AnalysisPageServer system---FastRWeb never
sees it directly. This means in particular that it doesn't have to be within the AnalysisPageServer hierarchy.EP
is non-NULL, then the location from which to serve
REST requests (relative to app base URL). Default: "/REST". Deprecated, and to be removed in a future version.app
is actually an AnalysisPageRegistry then ...
is passed through
h it to rapache.app.from.registry
to build the AnalysisPageRApacheApp
.
just a convenienthttp://rforge.net/FastRWeb/
(and http://rforge.net/Rserve/
) for information
about the FastRWeb/Rserve system. This function assumes that you've already got
a working installation of Rserve and fastRWeb, as described there.
As with that example, FastRWeb is a layer between Rserve and either CGI or PHP, so you
would also have to have a CGI or PHP server running. Or, you could try the experimental
http server that comes starting in Rserve 1.7.This function, new.FastRWeb.analysis.page.run
returns a function which can be used as the
run
function for a FastRWeb
script. So, typically, your FastRWeb script would do whatever necessary to create your
AnalysisPageServer Registry (or App object). Then, the last line of the script
would be to pass that object to this function, and assign the return value to run
.
In other words, this function would not normally be called interactively, but only
within the FastRWeb framework.
For development purposes it is quite convenient to build your AnalysisPageServer application within the FastRWeb script. For example, in the default configuration, you could put this into "/var/FastRWeb/web.R/APS.R":
library(AnalysisPageServer)
reg <- trig.registry()
run <- new.FastRWeb.analysis.page.run(reg, FastRWeb.scriptname = "APS")
This allows you to make changes to code and reload the page without restarting the server. In fact, any libraries will be reloaded, so you can change your package and re-install without restarting the server.
Once you want to move more into testing or production you'll want to do all the heavy
lifting in the startup script. You would have to save the run
object somewhere in the Global
namespace and then simply return in in the FastRWeb script. Under default FastRWeb configuration
you could add this code to the end of the startup script "/var/FastRWeb/code/rserve.R":
library(AnalysisPageServer)
myRun <- new.FastRWeb.analysis.page.run(trig.registry(), FastRWeb.scriptname = "APS")
Then, in "/var/FastRWeb/web.R/APS.R", you could just have nothing more than this:
run <- myRun
Note that the name of the FastRWeb script must be the same as FastRWeb.scriptname
, but
with a ".R" suffix appended.
It would be possible to extend this system to server multiple AnalysisPageServer apps from the
same FastRWeb setup. Each one would get its own FastRWeb script, and I leave it as an exercise
for the reader to build them all in the Rserve startup and assign the correct handler
to run
in each script.
In this example I point my browser to http://localhost/cgi-bin/R/APS/dist-aps/analysis-page-server.html
to open the page.
## Not run:
# library(AnalysisPageServer)
# reg <- trig.registry()
# run <- new.FastRWeb.analysis.page.run(reg)
# ## End(Not run)
message("See vignette FastRWebDeployment.html")
Run the code above in your browser using DataLab