ClintHeyer.Httpd
Class Context

A context is a `partition' of the server. Handlers are contexts. Servers are contexts. ServerManagers are contexts. A context can have sub-contexts. Each context can have its own configuration defined for it, or if it is missing, will use its parents configuration - Apache style.

Field Summary
System.Collections.Hashtable configuration
         Configuration data
System.Collections.ArrayList contexts
         Children contexts (Do not modify directly)
ClintHeyer.Httpd.IHandler FallbackReponder
         Fallback response handler
ClintHeyer.Httpd.Lock padlock
         Lock
ClintHeyer.Httpd.Context parent
         Parent context (Do not modify directly)
bool requiresSession
         Does context require a session
System.Collections.Hashtable responseHandlers
         Response handlers for context
ClintHeyer.Httpd.ISessionManager sessionManager
         Session manager
long throttleRate
         Throttling rate (bps) set to 0 for no throttling

Constructor Summary
Context()
         Empty constructor for serialization
Context(ClintHeyer.Httpd.Context parent, ClintHeyer.Httpd.Lock padlock)
         Constructor

Property Summary
ClintHeyer.Httpd.Lock Lock
         Gets or sets the lock to use for this context
ClintHeyer.Httpd.Context Parent
         Gets the parent context of this context
bool RequiresSession
         Gets or sets whether this context requires a valid session to be accessable
ClintHeyer.Httpd.ServerManager ServerManager
         Gets the ServerManager for this context
ClintHeyer.Httpd.ISessionManager SessionManager
         Gets or sets the session manager. If this context does not have a manager defined, it will return its parents.
long ThrottleRate
         Gets or sets the global throttling rate (Bps) for this context Child contexts also get modified by setting this property.
ClintHeyer.Httpd.TicketIssuer TicketIssuer
         Gets the ticket issuer instance for this context (if any)
string Url
         Gets the Url-root for this context

Method Summary
void AddContext(ClintHeyer.Httpd.Context context)
         Adds a child context. Child context will have their ThrottleRate to be the same as the parent
void AddResponseHandler(ClintHeyer.Httpd.HttpResponse response, ClintHeyer.Httpd.IHandler handler)
         Adds a response handler
bool CanHandleRequest(string request)
         Returns whether the request string falls under something this context can serve
ClintHeyer.Httpd.Context[] GetContexts()
         Gets all the children contexts of this context (not recursive)
string GetMimeType(string identifier)
         Returns the MIME type for a given identified (usually file extension) or the default type for this context
ClintHeyer.Httpd.IHandler GetResponseHandler(ClintHeyer.Httpd.HttpResponse response)
         Gets a handler for a given response
void Handle(ClintHeyer.Httpd.HttpRequest request, string p)
         Handles a request
object IConfigurable.Get(object key)
bool IConfigurable.GetBool(object key)
float IConfigurable.GetFloat(object key)
int IConfigurable.GetInt(object key)
string IConfigurable.GetString(object key)
void LoadConfig()
void OnReplyCompleted(ClintHeyer.Httpd.HttpReply reply)
         Notification from a reply that it has finished/closed. Override this, make sure base gets called
void OnReplyCompletedEvent(ClintHeyer.Httpd.Context source, ClintHeyer.Httpd.ReplyArgs args)
         Triggers reply completed event.
void OnReplyStarted(ClintHeyer.Httpd.HttpReply reply)
         Notification from a reply that it has started within this context
void OnReplyStartedEvent(ClintHeyer.Httpd.Context source, ClintHeyer.Httpd.ReplyArgs args)
         Triggers reply started event
void OnThrottleChange(ClintHeyer.Httpd.ThrottleChangeEvent args)
         Throttle has changed
void OnThrottleChangeEvent(ClintHeyer.Httpd.Context source, ClintHeyer.Httpd.ThrottleChangeEvent args)
         Triggers throttle change event
void RemoveContext(ClintHeyer.Httpd.Context context)
         Removes a child context.
void SaveConfig()

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

Event Summary
ClintHeyer.Httpd.ReplyCompletedEventHandler ReplyCompleted
         A reply has finished
ClintHeyer.Httpd.ReplyStartedEventHandler ReplyStarted
         A reply has started
ClintHeyer.Httpd.ThrottleChangeEventHandler ThrottleChange
         Throttle rate has changed


Field Detail

configuration

protected System.Collections.Hashtable configuration

Configuration data


contexts

protected System.Collections.ArrayList contexts

Children contexts (Do not modify directly)


FallbackReponder

public ClintHeyer.Httpd.IHandler FallbackReponder

Fallback response handler


padlock

protected ClintHeyer.Httpd.Lock padlock

Lock


parent

protected ClintHeyer.Httpd.Context parent

Parent context (Do not modify directly)


requiresSession

protected bool requiresSession

Does context require a session


responseHandlers

private System.Collections.Hashtable responseHandlers

Response handlers for context


sessionManager

protected ClintHeyer.Httpd.ISessionManager sessionManager

Session manager


throttleRate

protected long throttleRate

Throttling rate (bps) set to 0 for no throttling

Constructor Detail

Context

private Context()

Empty constructor for serialization


Context

public Context(ClintHeyer.Httpd.Context parent,
               ClintHeyer.Httpd.Lock padlock)

Constructor

Parameters:
parent - Parent
padlock - Lock
Property Detail

Lock

public ClintHeyer.Httpd.Lock Lock

Gets or sets the lock to use for this context


Parent

public ClintHeyer.Httpd.Context Parent

Gets the parent context of this context


RequiresSession

public bool RequiresSession

Gets or sets whether this context requires a valid session to be accessable


ServerManager

public ClintHeyer.Httpd.ServerManager ServerManager

Gets the ServerManager for this context


SessionManager

public ClintHeyer.Httpd.ISessionManager SessionManager

Gets or sets the session manager. If this context does not have a manager defined, it will return its parents.


ThrottleRate

public long ThrottleRate

Gets or sets the global throttling rate (Bps) for this context Child contexts also get modified by setting this property.


TicketIssuer

public ClintHeyer.Httpd.TicketIssuer TicketIssuer

Gets the ticket issuer instance for this context (if any)


Url

public string Url

Gets the Url-root for this context

Method Detail

AddContext

public void AddContext(ClintHeyer.Httpd.Context context)

Adds a child context. Child context will have their ThrottleRate to be the same as the parent

Parameters:
context - Context

AddResponseHandler

public void AddResponseHandler(ClintHeyer.Httpd.HttpResponse response,
                               ClintHeyer.Httpd.IHandler handler)

Adds a response handler

Parameters:
response - Response to handle
handler - Handler

CanHandleRequest

public bool CanHandleRequest(string request)

Returns whether the request string falls under something this context can serve

Parameters:
request - Request
Returns:
Whether context can handle this request (false by default)

GetContexts

public ClintHeyer.Httpd.Context[] GetContexts()

Gets all the children contexts of this context (not recursive)

Returns:
Children contexts

GetMimeType

public string GetMimeType(string identifier)

Returns the MIME type for a given identified (usually file extension) or the default type for this context

Parameters:
identifier - MIME identified
Returns:
MIME type

GetResponseHandler

public ClintHeyer.Httpd.IHandler GetResponseHandler(ClintHeyer.Httpd.HttpResponse response)

Gets a handler for a given response

Parameters:
response - Response
Returns:
Handler

Handle

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

Handles a request

Parameters:
request - Request
p - Extra path information

IConfigurable.Get

private object IConfigurable.Get(object key)


IConfigurable.GetBool

private bool IConfigurable.GetBool(object key)


IConfigurable.GetFloat

private float IConfigurable.GetFloat(object key)


IConfigurable.GetInt

private int IConfigurable.GetInt(object key)


IConfigurable.GetString

private string IConfigurable.GetString(object key)


LoadConfig

public void LoadConfig()


OnReplyCompleted

public void OnReplyCompleted(ClintHeyer.Httpd.HttpReply reply)

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

Parameters:
reply - Reply that has finished

OnReplyCompletedEvent

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

Triggers reply completed event.

Parameters:
source - Source
args - Event args

OnReplyStarted

public void OnReplyStarted(ClintHeyer.Httpd.HttpReply reply)

Notification from a reply that it has started within this context

If overridden, ensure that base gets called, which triggers events

Parameters:
reply - Reply

OnReplyStartedEvent

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

Triggers reply started event

Parameters:
source - Source
args - Event args

OnThrottleChange

protected void OnThrottleChange(ClintHeyer.Httpd.ThrottleChangeEvent args)

Throttle has changed

Parameters:
args - Event args

OnThrottleChangeEvent

protected void OnThrottleChangeEvent(ClintHeyer.Httpd.Context source,
                                     ClintHeyer.Httpd.ThrottleChangeEvent args)

Triggers throttle change event

Parameters:
source - Source
args - Event args

RemoveContext

public void RemoveContext(ClintHeyer.Httpd.Context context)

Removes a child context.

Parameters:
context - Context to remove

SaveConfig

public void SaveConfig()

Event Detail

ReplyCompleted

public ClintHeyer.Httpd.ReplyCompletedEventHandler ReplyCompleted

A reply has finished


ReplyStarted

public ClintHeyer.Httpd.ReplyStartedEventHandler ReplyStarted

A reply has started


ThrottleChange

public ClintHeyer.Httpd.ThrottleChangeEventHandler ThrottleChange

Throttle rate has changed