HttpDaemon              package:R.httpd              R Documentation

_T_h_e _H_t_t_p_D_a_e_m_o_n _c_l_a_s_s

_D_e_s_c_r_i_p_t_i_o_n:

     Package:  R.httpd 
      *Class HttpDaemon*

     'Object'
      '~~|'
      '~~+--''HttpDaemon'

     *Directly known subclasses:*


     public static class *HttpDaemon*
      extends Object

     A minimalistic HTTP daemon (web server) that preprocesses R Server
     Pages.

_U_s_a_g_e:

     HttpDaemon(...)

_A_r_g_u_m_e_n_t_s:

     ...: Not used.

_D_e_t_a_i_l_s:

     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.

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

_F_i_e_l_d_s _a_n_d _M_e_t_h_o_d_s:

     *Methods:*

         'appendRootPaths'     Appends and inserts new paths to the list of known root directories.
         'as.character'        Returns a short string describing the HTTP daemon.
         'finalize'            -
         'getConfig'           Retrieves the servers 'config' structure from Tcl.
         'getCount'            -
         'getDefaultFilename'  Gets the default filename to be loaded by the HTTP daemon.
         'getHttpRequest'      Gets the HTTP request.
         'getPort'             Gets the socket port of the HTTP daemon.
         'getRootPaths'        Gets the root directories of the HTTP daemon.
         'insertRootPaths'     -
         'isStarted'           Checks if the HTTP daemon is started.
         'openUrl'             Starts the HTTP daemon and launches the specified URL.
         'process'             Processes the file requested.
         'restart'             Restarts the HTTP daemon.
         'setCount'            -
         'setRootPaths'        Sets a new set of root directories for the HTTP daemon.
         'sourceTcl'           Loads the Tcl source for the HTTP daemon into R.
         'start'               Starts the HTTP daemon.
         'startHelp'           Starts the HTTP daemon and launches the help page.
         'stop'                Stops the HTTP daemon.
         'writeResponse'       Writes a string to the HTTP output connection.

     *Methods inherited from Object*:
      $, $<-, [[, [[<-, as.character, attach, attachLocally,
     clearCache, clone, detach, equals, extend, finalize, gc,
     getEnvironment, getFields, getInstanciationTime,
     getStaticInstance, hasField, hashCode, ll, load, objectSize,
     print, save

_A_u_t_h_o_r(_s):

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

_R_e_f_e_r_e_n_c_e_s:

     [1] Rpad package, Tom Short, 2005.

_E_x_a_m_p_l_e_s:

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

