MaServer Class Reference

Inheritance diagram for MaServer:

MprLink List of all members.

Detailed Description

HTTP server possibly listening on multiple ports.

An application may have any number of HTTP servers, each managed by an instance of the Server class. Typically there will be only one server in an application. There may be multiple virtual hosts and one default host for each server class. A server will typically be configured by calling the configure method for each server which parses a file to define the server and virtual host configuration.

Stability classification:
Evolving.


Public Member Functions

int configure (char *configFile)
int getLine ()
MprListgetList ()
 Destructor.
void insertAfter (MprLink *item)
 Return the owning list Insert after this member.
void insertPrior (MprLink *item)
 Insert prior to this member.
int loadModule (char *name, char *libname=0)
 MaServer (MaHttp *hs, char *name, char *root=0, char *ipAddr=0, int port=0)
MaHostnewHost (char *docRoot, char *ipSpec=0)
int saveConfig (char *configFile)
int start ()
int stop ()

Constructor & Destructor Documentation

MaServer::MaServer ( MaHttp hs,
char *  name,
char *  root = 0,
char *  ipAddr = 0,
int  port = 0 
)

Synopsis:
Constructor to create a HTTP server.
Overview:
Creates a logical HTTP server that may consist of multiple virtual servers.
Parameters:
hs Pointer to the MaHttp object created by maCreateHttp.
name Descriptive name to give to the server.
root Top level path of the directory containing the server.
ipAddr IP address to listen to
port Port number to listen to
Stability classification:
Evolving.
Library:
libappweb
See also:
~MaServer, configure


Member Function Documentation

int MaServer::configure ( char *  configFile  ) 

Synopsis:
configure the entire server from a configuration file.
Overview:
Servers are configured via an Apache-style configuration file. A server may listen on multiple ports and may contain multiple virtual hosts.
Parameters:
configFile Path of the configuration file.
Returns:
Returns zero if successful, otherwise a negative MPR error code.
Configure options:
Requires BLD_FEATURE_CONFIG_PARSE.

int MaServer::getLine (  )  [inline]

Synopsis:
Return the current configuration file line number
Overview:
If a error is encountered when parsing the configuration file, getLine will return the current line number for error reporting purposes.
Returns:
The current line number (origin 1).
Stability classification:
Evolving.
Library:
libappweb
See also:
configure

int MaServer::loadModule ( char *  name,
char *  libname = 0 
)

Synopsis:
Load an AppWeb module
Overview:
This routine loads the given module. the designated the AppWeb configuration file.
Parameters:
name The module name is the pure module prefix. Eg. "cgi".
libname The libname should not include an extension. Eg. "libcgiModule".
Returns:
Returns zero if successful
Stability classification:
Evolving.
Library:
libappweb
See also:
addHandler

MaHost * MaServer::newHost ( char *  docRoot,
char *  ipSpec = 0 
)

Synopsis:
Create a new host
Overview:
Create a new host for this server
Parameters:
docRoot Directory containing web content to be served
ipSpec IP:PORT address to use as a ServerName for redirections
Returns:
Returns zero if successful
Stability classification:
Evolving.
Library:
libappweb
See also:
configure

int MaServer::saveConfig ( char *  configFile  ) 

Synopsis:
Save the current configuration to the named file
Overview:
This routine will save the run-time configuration to the designated the AppWeb configuration file.
Parameters:
configFile Name of the file to save to
Returns:
Returns zero if successful
Stability classification:
Evolving.
Library:
libappweb
Configure options:
Requires BLD_FEATURE_CONFIG_SAVE.
See also:
configure

int MaServer::start (  ) 

Synopsis:
Start the server.
Overview:
Call to start all hosts within the server.
Returns:
Returns zero if successful, otherwise return a negative MPR error code.

int MaServer::stop (  ) 

Synopsis:
Stop the server.
Overview:
Call to stop all hosts within the server.
Returns:
Returns zero if successful, otherwise return a negative MPR error code.


The documentation for this class was generated from the following files:

© Mbedthis Software LLC, 2003-2006. All rights reserved. Mbedthis is a trademark of Mbedthis Software LLC.