C# Class Bloom.Api.ServerBase

Inheritance: IDisposable
Show file Open project: BloomBooks/BloomDesktop Class Usage Examples

Public Properties

Property Type Description
portForHttp int

Private Properties

Property Type Description
AttemptToOpenPort bool
EnqueueIncomingRequests void
GetLocalPathWithoutQuery string
GetServerStartFailureMessage string
MakeReply void
QueueRequest void
ReportMissingFile void
RequestProcessorLoop void
SpinUpAWorker void
VerifyWeAreNowListening void

Public Methods

Method Description
Dispose ( ) : void
GetContentType ( string extension ) : string
StartListening ( ) : void

Protected Methods

Method Description
Dispose ( bool fDisposing ) : void
GetLocalPathWithoutQuery ( IRequestInfo info ) : string
IgnoreFileIfMissing ( string localPath ) : bool

Check for files that may be missing but that we know aren't important enough to complain about.

IsRecursiveRequestContext ( HttpListenerContext context ) : bool

Return true if producing the result requested by the context may involve making additional requests to the server. (See the fuller discussion on the declaration of _threadsDoingRecursiveRequests.)

ProcessRequest ( IRequestInfo info ) : bool

This method is overridden in classes inheriting from this class to handle specific request types

ServerBase ( ) : System

Private Methods

Method Description
AttemptToOpenPort ( ) : bool

Tries to start listening on the currently proposed server url

EnqueueIncomingRequests ( ) : void

The _listenerThread runs this method, and exits when the _stop event is raised

GetLocalPathWithoutQuery ( string localPath ) : string
GetServerStartFailureMessage ( ) : string
MakeReply ( IRequestInfo info ) : void

This is designed to be easily unit testable by not taking actual HttpContext, but doing everything through this IRequestInfo object

QueueRequest ( IAsyncResult ar ) : void

This method is called in the _listenerThread when we obtain an HTTP request from the _listener, and queues it for processing by a worker.

ReportMissingFile ( IRequestInfo info ) : void
RequestProcessorLoop ( ) : void

The worker threads run this function

SpinUpAWorker ( ) : void
VerifyWeAreNowListening ( ) : void

Method Details

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool fDisposing ) : void
fDisposing bool
return void

GetContentType() public static method

public static GetContentType ( string extension ) : string
extension string
return string

GetLocalPathWithoutQuery() protected static method

protected static GetLocalPathWithoutQuery ( IRequestInfo info ) : string
info IRequestInfo
return string

IgnoreFileIfMissing() protected method

Check for files that may be missing but that we know aren't important enough to complain about.
protected IgnoreFileIfMissing ( string localPath ) : bool
localPath string
return bool

IsRecursiveRequestContext() protected method

Return true if producing the result requested by the context may involve making additional requests to the server. (See the fuller discussion on the declaration of _threadsDoingRecursiveRequests.)
protected IsRecursiveRequestContext ( HttpListenerContext context ) : bool
context System.Net.HttpListenerContext
return bool

ProcessRequest() protected method

This method is overridden in classes inheriting from this class to handle specific request types
protected ProcessRequest ( IRequestInfo info ) : bool
info IRequestInfo
return bool

ServerBase() protected method

protected ServerBase ( ) : System
return System

StartListening() public method

public StartListening ( ) : void
return void

Property Details

portForHttp public static property

public static int portForHttp
return int