ClintHeyer.Httpd
Class Server

Server

Field Summary
ClintHeyer.Httpd.IHandler indexHandler
int maximumRequests
System.Random ran
int requestsInProgress
System.Threading.ReaderWriterLock rwl

Fields inherited from class ClintHeyer.Httpd.Context
configuration, contexts, padlock, parent, requiresSession, sessionManager, throttleRate

Constructor Summary
Server(ClintHeyer.Httpd.Context parent)
         Constructor

Property Summary
ClintHeyer.Httpd.IHandler IndexHandler
         Gets or sets the index handler
int MaximumRequests
         Gets or sets the maximum number of requests the server can handle (set to 0 to disable limiting)
int RequestsInProgress
         Gets the number of requests in progress in this server
string Url
         Gets the url for this server

Properties inherited from class ClintHeyer.Httpd.Context
Lock, Parent, RequiresSession, ServerManager, SessionManager, ThrottleRate, TicketIssuer

Method Summary
void GCRequests()
         Cleans up after any requests that get started (and counted), but don't close properly
void Handle(ClintHeyer.Httpd.HttpRequest request, string extraPath)
         Handle a request
bool IsOverloaded(ClintHeyer.Httpd.HttpRequest request)
         Gets whether server is overloaded
void LoadConfig()
void OnReplyCompletedEvent(ClintHeyer.Httpd.Context source, ClintHeyer.Httpd.ReplyArgs args)
         Notification from a reply that it has finished/closed. Override this, make sure base gets called
void OnReplyStartedEvent(ClintHeyer.Httpd.Context source, ClintHeyer.Httpd.ReplyArgs args)
ClintHeyer.Httpd.ResolvePath Resolve(ClintHeyer.Httpd.HttpRequest request)
         Resolves a path
ClintHeyer.Httpd.ResolvePath ResolveFromContexts(ClintHeyer.Httpd.URI uri)
         Resolves a path
string SafePath(string path)
         Tries to eliminate any characters that could cause problems later on
void SaveConfig()

Methods inherited from class ClintHeyer.Httpd.Context
AddContext, AddResponseHandler, CanHandleRequest, GetContexts, GetMimeType, GetResponseHandler, IConfigurable.Get, IConfigurable.GetBool, IConfigurable.GetFloat, IConfigurable.GetInt, IConfigurable.GetString, OnReplyCompleted, OnReplyStarted, OnThrottleChange, OnThrottleChangeEvent, RemoveContext

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString

Events inherited from class ClintHeyer.Httpd.Context
ReplyCompleted, ReplyStarted, ThrottleChange


Field Detail

indexHandler

private ClintHeyer.Httpd.IHandler indexHandler


maximumRequests

private int maximumRequests


ran

private System.Random ran


requestsInProgress

private int requestsInProgress


rwl

private System.Threading.ReaderWriterLock rwl

Constructor Detail

Server

public Server(ClintHeyer.Httpd.Context parent)

Constructor

Parameters:
parent - Parent context (usually a ServerManager)
Property Detail

IndexHandler

public ClintHeyer.Httpd.IHandler IndexHandler

Gets or sets the index handler


MaximumRequests

public int MaximumRequests

Gets or sets the maximum number of requests the server can handle (set to 0 to disable limiting)


RequestsInProgress

public int RequestsInProgress

Gets the number of requests in progress in this server


Url

public string Url

Gets the url for this server

Method Detail

GCRequests

private void GCRequests()

Cleans up after any requests that get started (and counted), but don't close properly


Handle

public void Handle(ClintHeyer.Httpd.HttpRequest request,
                   string extraPath)

Handle a request

Parameters:
request - Request
extraPath - Extra path
Throws:
ClintHeyer.Httpd.ResourceLockedException - Locked

IsOverloaded

public bool IsOverloaded(ClintHeyer.Httpd.HttpRequest request)

Gets whether server is overloaded


LoadConfig

public void LoadConfig()


OnReplyCompletedEvent

public void OnReplyCompletedEvent(ClintHeyer.Httpd.Context source,
                                  ClintHeyer.Httpd.ReplyArgs args)

Notification from a reply that it has finished/closed. Override this, make sure base gets called

Parameters:
reply - Reply

OnReplyStartedEvent

public void OnReplyStartedEvent(ClintHeyer.Httpd.Context source,
                                ClintHeyer.Httpd.ReplyArgs args)


Resolve

public ClintHeyer.Httpd.ResolvePath Resolve(ClintHeyer.Httpd.HttpRequest request)

Resolves a path

Parameters:
request - Request
Returns:
Path

ResolveFromContexts

public ClintHeyer.Httpd.ResolvePath ResolveFromContexts(ClintHeyer.Httpd.URI uri)

Resolves a path

Parameters:
uri - Uri
Returns:
Path

SafePath

private string SafePath(string path)

Tries to eliminate any characters that could cause problems later on

Parameters:
path -
Returns:
Safe version of path

SaveConfig

public void SaveConfig()