Builder-class: Class 'Builder'

Description Methods See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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)

jeffreyhorner/Rook documentation built on May 19, 2019, 4:01 a.m.