new.FastRWeb.analysis.page.run {AnalysisPageServer} | R Documentation

## new.FastRWeb.analysis.page.run

### Description

Given an RApacheAnalysisPageServer object, create a FastRWeb-compatible handler

### Usage

    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), ...)

### Arguments

`app` | AnalysisPageRApacheApp. Or an AnalysisPageRegistry from which to build an app (see `...`).
`FastRWeb.scriptname` | Name for the app within FastRWeb. A script called `FastRWeb.R` would be created, and the URL would be `FastRWeb.prefix/FastRWeb.scriptname`.
`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 `FastRWeb.scriptname` for `APS` and `front.end.location` for `client`).
`APS.resources.location` | Location relative to App base URL from which to serve dynamic AnalysisPageServer resources (like `analysis`, `pages`, and other details that normal users don't have to worry about). Default, "R", is probably fine.
`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: `system.file("htdocs", package = 'AnalysisPageServer')`
`tmpdir` | Path to temporary directory to store files needed while the server is running. Default: `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.
`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 `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.
`verbose` | Boolean, default FALSE. If TRUE then send progress messages.
`logger` | log4r object, optional
`...` | If `app` is actually an AnalysisPageRegistry then `...` is passed through h it to `rapache.app.from.registry` to build the `AnalysisPageRApacheApp`. just a convenient

### Details

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.

### Value

Not sure yet....

### Author(s)

Brad Friedman

### Examples

    ## Not run:
      library(AnalysisPageServer)
      reg <- trig.registry()
      run <- new.FastRWeb.analysis.page.run(reg)

    ## End(Not run)
    message("See vignette FastRWebDeployment.html")

[Package AnalysisPageServer version 1.16.0 Index]