C# Class GnomeServer.IntegratedWebServer

Inheritance: IWebServer
Show file Open project: Rychard/GnomeServer

Public Methods

Method Description
GetWebRoot ( ) : String

Gets the full path to the directory where static pages are served from.

IntegratedWebServer ( ) : System

Initializes a new instance of the IntegratedWebServer class.

LogMessage ( String message, String label = null ) : void

Adds a timestamp to the specified message, and appends it to the internal log.

Start ( ) : void
Stop ( ) : void

Private Methods

Method Description
FetchHandlers ( Assembly assembly ) : IEnumerable
FindHandlersInLoadedAssemblies ( ) : IEnumerable

Searches all the assemblies in the current AppDomain, and returns a collection of those that implement the IRequestHandler interface.

HandleRequest ( HttpListenerRequest request, HttpListenerResponse response ) : void

; Handles the specified request.

Defers execution to an appropriate request handler, except for requests to the reserved endpoints: ~/ and ~/Log.
Returns a default error message if an appropriate request handler can not be found.

RegisterHandlers ( ) : void

Searches all the assemblies in the current AppDomain for class definitions that implement the IRequestHandler interface. Those classes are instantiated and registered as request handlers.

RegisterHandlers ( IEnumerable handlers ) : void
ReleaseServer ( ) : void
RequestHandlerLogAppender_OnLogMessage ( Object sender, LogAppenderEventArgs logAppenderEventArgs ) : void
ServerOnLogMessage ( Object sender, LogAppenderEventArgs args ) : void

Writes the value of args.LogAppenderEventArgs.LogLine to the internal log.

ServiceFileRequest ( String wwwroot, HttpListenerRequest request, HttpListenerResponse response ) : void
ServiceLog ( HttpListenerRequest request, HttpListenerResponse response ) : System.Boolean

Services requests to ~/Log

ServiceRoot ( HttpListenerRequest request, HttpListenerResponse response ) : System.Boolean

Services requests to ~/

Method Details

GetWebRoot() public static method

Gets the full path to the directory where static pages are served from.
public static GetWebRoot ( ) : String
return String

IntegratedWebServer() public method

Initializes a new instance of the IntegratedWebServer class.
public IntegratedWebServer ( ) : System
return System

LogMessage() public static method

Adds a timestamp to the specified message, and appends it to the internal log.
public static LogMessage ( String message, String label = null ) : void
message String
label String
return void

Start() public method

public Start ( ) : void
return void

Stop() public method

public Stop ( ) : void
return void