File: HttpDaemon.Rd

package info (click to toggle)
r-cran-r.rsp 0.46.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,472 kB
  • sloc: javascript: 612; tcl: 304; sh: 18; makefile: 16
file content (115 lines) | stat: -rw-r--r-- 4,412 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do not modify this file since it was automatically generated from:
% 
%  HttpDaemon.R
% 
% by the Rdoc compiler part of the R.oo package.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\name{HttpDaemon}
\docType{class}
\alias{HttpDaemon}


\title{The HttpDaemon class}

\description{
 Package:  R.rsp \cr
\bold{Class HttpDaemon}\cr

\code{\link[R.oo]{Object}}\cr
\code{~~|}\cr
\code{~~+--}\code{HttpDaemon}\cr

\bold{Directly known subclasses:}\cr
\cr

public static class \bold{HttpDaemon}\cr
extends \link[R.oo]{Object}\cr



 A minimalistic HTTP daemon (web server) that also preprocesses RSP.
}

\usage{
HttpDaemon(...)
}

\arguments{
  \item{...}{Not used.}
}

\section{Fields and Methods}{
 \bold{Methods:}\cr
\tabular{rll}{
 \tab \code{\link[R.rsp:appendRootPaths.HttpDaemon]{appendRootPaths}} \tab Appends and inserts new paths to the list of known root directories.\cr
 \tab \code{\link[R.rsp:as.character.HttpDaemon]{as.character}} \tab Returns a short string describing the HTTP daemon.\cr
 \tab \code{finalize} \tab  -\cr
 \tab \code{\link[R.rsp:getConfig.HttpDaemon]{getConfig}} \tab Retrieves the server's 'config' structure from Tcl.\cr
 \tab \code{getCount} \tab  -\cr
 \tab \code{\link[R.rsp:getDefaultFilenamePattern.HttpDaemon]{getDefaultFilenamePattern}} \tab Gets the default filename pattern to be loaded by the HTTP daemon.\cr
 \tab \code{\link[R.rsp:getHttpRequest.HttpDaemon]{getHttpRequest}} \tab Gets the HTTP request.\cr
 \tab \code{\link[R.rsp:getPort.HttpDaemon]{getPort}} \tab Gets the socket port of the HTTP daemon.\cr
 \tab \code{\link[R.rsp:getRootPaths.HttpDaemon]{getRootPaths}} \tab Gets the root directories of the HTTP daemon.\cr
 \tab \code{insertRootPaths} \tab  -\cr
 \tab \code{\link[R.rsp:isStarted.HttpDaemon]{isStarted}} \tab Checks if the HTTP daemon is started.\cr
 \tab \code{\link[R.rsp:openUrl.HttpDaemon]{openUrl}} \tab Starts the HTTP daemon and launches the specified URL.\cr
 \tab \code{\link[R.rsp:processRsp.HttpDaemon]{processRsp}} \tab Processes an RSP page.\cr
 \tab \code{\link[R.rsp:restart.HttpDaemon]{restart}} \tab Restarts the HTTP daemon.\cr
 \tab \code{setCount} \tab  -\cr
 \tab \code{\link[R.rsp:setRootPaths.HttpDaemon]{setRootPaths}} \tab Sets a new set of root directories for the HTTP daemon.\cr
 \tab \code{\link[R.rsp:sourceTcl.HttpDaemon]{sourceTcl}} \tab Loads the Tcl source for the HTTP daemon into R.\cr
 \tab \code{\link[R.rsp:start.HttpDaemon]{start}} \tab Starts the HTTP daemon.\cr
 \tab \code{\link[R.rsp:startHelp.HttpDaemon]{startHelp}} \tab Starts the HTTP daemon and launches the help page.\cr
 \tab \code{\link[R.rsp:terminate.HttpDaemon]{terminate}} \tab Terminates the HTTP daemon.\cr
 \tab \code{\link[R.rsp:writeResponse.HttpDaemon]{writeResponse}} \tab Writes a string to the HTTP output connection.\cr
}


 \bold{Methods inherited from Object}:\cr
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save


}

\details{
 The actual server is written in Tcl such that it runs in a non-blocking
 mode, which means that the R prompt will be available for other things.
 This class is tightly coupled with the source code of the Tcl script.

 For security reasons, the server only accept connections from the
 local host (127.0.0.1).  This lowers the risk for external computers
 to gain access to the R session.
 This is asserted by the \code{accept_connect} Tcl procedure in
 r-httpd.tcl (located in \code{system.file("tcl/", package="R.rsp")}).
 If access from other hosts are wanted, then this procedure needs to
 be modified.

 The Tcl server was written by Steve Uhlers, and later adopted for R by
 Philippe Grosjean and Tom Short (Rpad package author) [1].
}

\examples{
if (interactive()) {
  if (!HttpDaemon$isStarted()) {
    # Start the web server
    rootPath <- system.file("rsp", package="R.rsp")
    HttpDaemon$start(rootPath=rootPath, port=8074, default="^index[.](html|.*)$")
  }
 
  browseURL("http://127.0.0.1:8074/")
}
}

\references{
  [1] Rpad package, Tom Short, 2005.\cr
}

\author{Henrik Bengtsson}



\keyword{classes}
\keyword{IO}
\keyword{internal}