Description Usage Arguments Details Value Author(s) Examples
View source: R/FastRWeb.analysis.page.server.R
Given an RApacheAnalysisPageServer object, create a FastRWeb-compatible handler
1 2 3 4 5 6 7 8 | 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), ...)
|
app |
AnalysisPageRApacheApp. Or an AnalysisPageRegistry from which to build an app
(see |
FastRWeb.scriptname |
Name for the app within FastRWeb. A script called |
FastRWeb.prefix |
Prefix for all the FastRWeb resources on your server.
For example, if you are using a typical CGI
deployment, as described in the FastRWeb INSTALL document, it would be "/cgi-bin/R",
and your AnalysisPageServer app would be a group of URLs like /cgi-bin/R/APS/client/analysis-page-server.html etc
(but see |
APS.resources.location |
Location relative to App base URL from which to serve
dynamic AnalysisPageServer resources (like |
front.end.location |
Location relative to App base URL from which to serve front end files. Default, "/client", is probably fine. |
front.end.dir |
Path (in filesystem) to front end files. Default:
|
tmpdir |
Path to temporary directory to store files needed while the server is running. Default: |
FastRWeb.tmpdir |
This is the path to FastRWeb's tmpdir. FastRWeb will only serve temporary files out of that directory. |
referer |
FastRWeb does not (currently) parse the Referer from the headers, but you can put a string here which will be interpreted as such. I only put this here if you have an app which fails catastrophically if referer is unavaiable. |
EP |
ExpressionPlotClient object, if needed for your app. Deprecated, and to be removed in a future version. |
REST.location |
If |
verbose |
Boolean, default FALSE. If TRUE then send progress messages. |
logger |
log4r object, optional |
... |
If |
FastRWeb is another alternative for deployment of AnalysisPageServer applications.
The benefit relative to Apache/RApache is that it may be easier to deploy. The
benefit relative to Rook/Rhttpd is that it actually works (Rhttpd cannot handle
concurrent connections). See http://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 sure yet....
Brad Friedman
1 2 3 4 5 6 7 | ## Not run:
library(AnalysisPageServer)
reg <- trig.registry()
run <- new.FastRWeb.analysis.page.run(reg)
## End(Not run)
message("See vignette FastRWebDeployment.html")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.