Builder-class: Class 'Builder'

Builder-classR Documentation

Class Builder

Description

A convenience object for combining various Middleware with a default application to create a more complex Rook application.

Methods

new(...):

Arguments can be any Middleware object while the last argument in the list must be a valid Rook application. That is, it will handle the incoming request without deferring to another application.

See Also

Rhttpd, Static, Brewery, and Redirect.

Examples


# The following is the Hmisc example. Explore the folder
# system.file('exampleApps/Hmisc',package='Rook') for more information.
s <- Rhttpd$new()
## Not run: 
library(Hmisc)
dir.create(file.path(tempdir(),'plots'),showWarnings=FALSE)
s$add( name="Hmisc",
    app=Builder$new(
        Static$new(
            urls = c('/css','/images','/javascript'),
            root = system.file('exampleApps/Hmisc',package='Rook')
        ),
        Static$new(urls='/plots',root=tempdir()),
        Brewery$new(
            url='/brew',
            root= system.file('exampleApps/Hmisc',package='Rook'),
            imagepath=file.path(tempdir(),'plots'),
            imageurl='../plots/'
        ),
        Redirect$new('/brew/useR2007.rhtml')
    )
)
s$start(quiet=TRUE)
s$browse('Hmisc') # Opens a browser window to the application.
s$remove(all=TRUE)
s$stop()

## End(Not run)

Rook documentation built on Nov. 10, 2022, 6:13 p.m.