C# Class Woopsa.WoopsaServer

Inheritance: IDisposable
显示文件 Open project: woopsa-protocol/Woopsa Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void
EnterModelAccessFreeSection ( ) : WoopsaServerModelAccessFreeSection

This method simply calls BeforeWoopsaModelAccess to trigger concurrent access protection over the woopsa model.

ShutDown ( ) : void
WoopsaServer ( IWoopsaContainer root, WebServer server, string routePrefix = DefaultServerPrefix ) : System

Creates an instance of the Woopsa server without using the Reflector. You will have to create the object hierarchy yourself, using WoopsaObjects or implementing IWoopsaContainer yourself. If you are already using a WebServer somewhere else, this constructor will simply add the woopsa routes to that server. This allows you to serve static content and the Woopsa protocol on the same network interface and on the same port.

WoopsaServer ( IWoopsaContainer root, int port = DefaultPort, string routePrefix = DefaultServerPrefix, int threadPoolSize = CustomThreadPool.DefaultThreadPoolSize, ThreadPriority priority = DefaultThreadPriority ) : System

Creates an instance of the Woopsa server without using the Reflector. You will have to create the object hierarchy yourself, using WoopsaObjects or implementing IWoopsaContainer yourself. It will automatically create the required HTTP server on the specified port and will prefix woopsa verbs with the specified route prefix. It will also add all the necessary native extensions for Publish/Subscribe and Mutli-Requests.

WoopsaServer ( WoopsaObject root, int port = DefaultPort, string routePrefix = DefaultServerPrefix ) : System

Creates an instance of the Woopsa server adding multiRequestHandler and SubscriptionService It will automatically create the required HTTP server on the specified port and will prefix woopsa verbs with the specified route prefix. It will also add all the necessary native extensions for Publish/Subscribe and Mutli-Requests.

WoopsaServer ( object root, int port = DefaultPort, string routePrefix = DefaultServerPrefix ) : System

Creates an instance of the Woopsa server with a new Reflector for the object passed to it. It will automatically create the required HTTP server on the specified port and will prefix woopsa verbs with the specified route prefix. It will also add all the necessary native extensions for Publish/Subscribe and Mutli-Requests.

Protected Methods

Method Description
Dispose ( bool disposing ) : void
ExecuteAfterWoopsaModelAccess ( ) : void
ExecuteBeforeWoopsaModelAccess ( ) : void
OnAfterWoopsaModelAccess ( ) : void
OnBeforeWoopsaModelAccess ( ) : void

Private Methods

Method Description
AddRoutes ( ) : void
FindByPath ( string searchPath ) : IWoopsaElement
GetMetadata ( string path ) : string
HandleRequest ( WoopsaVerb verb, HTTPRequest request, HTTPResponse response ) : void
InvokeMethod ( string path, NameValueCollection arguments ) : string
InvokeMethodDeserializedJson ( string path, object>.Dictionary arguments ) : string
ReadValue ( string path ) : string
RemoveRoutes ( ) : void
WriteValue ( string path, string value ) : string
WriteValueDeserializedJson ( string path, object deserializedJson ) : string

Method Details

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

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

EnterModelAccessFreeSection() public method

This method simply calls BeforeWoopsaModelAccess to trigger concurrent access protection over the woopsa model.
public EnterModelAccessFreeSection ( ) : WoopsaServerModelAccessFreeSection
return WoopsaServerModelAccessFreeSection

ExecuteAfterWoopsaModelAccess() protected method

protected ExecuteAfterWoopsaModelAccess ( ) : void
return void

ExecuteBeforeWoopsaModelAccess() protected method

protected ExecuteBeforeWoopsaModelAccess ( ) : void
return void

OnAfterWoopsaModelAccess() protected method

protected OnAfterWoopsaModelAccess ( ) : void
return void

OnBeforeWoopsaModelAccess() protected method

protected OnBeforeWoopsaModelAccess ( ) : void
return void

ShutDown() public method

public ShutDown ( ) : void
return void

WoopsaServer() public method

Creates an instance of the Woopsa server without using the Reflector. You will have to create the object hierarchy yourself, using WoopsaObjects or implementing IWoopsaContainer yourself. If you are already using a WebServer somewhere else, this constructor will simply add the woopsa routes to that server. This allows you to serve static content and the Woopsa protocol on the same network interface and on the same port.
public WoopsaServer ( IWoopsaContainer root, WebServer server, string routePrefix = DefaultServerPrefix ) : System
root IWoopsaContainer The root object that will be published via Woopsa.
server WebServer The server on which Woopsa routes will be added
routePrefix string /// The prefix to add to all routes for woopsa verbs. For example, specifying /// "myPrefix" will make the server available on http://server/myPrefix ///
return System

WoopsaServer() public method

Creates an instance of the Woopsa server without using the Reflector. You will have to create the object hierarchy yourself, using WoopsaObjects or implementing IWoopsaContainer yourself. It will automatically create the required HTTP server on the specified port and will prefix woopsa verbs with the specified route prefix. It will also add all the necessary native extensions for Publish/Subscribe and Mutli-Requests.
public WoopsaServer ( IWoopsaContainer root, int port = DefaultPort, string routePrefix = DefaultServerPrefix, int threadPoolSize = CustomThreadPool.DefaultThreadPoolSize, ThreadPriority priority = DefaultThreadPriority ) : System
root IWoopsaContainer The root object that will be published via Woopsa.
port int The port on which to run the web server
routePrefix string /// The prefix to add to all routes for woopsa verbs. For example, specifying /// "myPrefix" will make the server available on http://server/myPrefix ///
threadPoolSize int /// The maximum number of threads to be created. /// CustomThreadPool.DefaultThreadPoolSize means use default operating system value.
priority ThreadPriority /// The priority of the server threads. ///
return System

WoopsaServer() public method

Creates an instance of the Woopsa server adding multiRequestHandler and SubscriptionService It will automatically create the required HTTP server on the specified port and will prefix woopsa verbs with the specified route prefix. It will also add all the necessary native extensions for Publish/Subscribe and Mutli-Requests.
public WoopsaServer ( WoopsaObject root, int port = DefaultPort, string routePrefix = DefaultServerPrefix ) : System
root WoopsaObject The root object that will be published via Woopsa.
port int The port on which to run the web server
routePrefix string /// The prefix to add to all routes for woopsa verbs. For example, specifying /// "myPrefix" will make the server available on http://server/myPrefix ///
return System

WoopsaServer() public method

Creates an instance of the Woopsa server with a new Reflector for the object passed to it. It will automatically create the required HTTP server on the specified port and will prefix woopsa verbs with the specified route prefix. It will also add all the necessary native extensions for Publish/Subscribe and Mutli-Requests.
public WoopsaServer ( object root, int port = DefaultPort, string routePrefix = DefaultServerPrefix ) : System
root object The root object that will be published via Woopsa.
port int The port on which to run the web server
routePrefix string /// The prefix to add to all routes for woopsa verbs. For example, specifying /// "myPrefix" will make the server available on http://server/myPrefix ///
return System