/// <summary> /// Start the WebDAV interface using the given ip address, port and HTTPSecurity parameters. /// </summary> /// <param name="myIPAddress">The IPAddress for binding the interface at</param> /// <param name="myPort">The port for binding the interface at</param> /// <param name="myHttpWebSecurity">A HTTPSecurity class for checking security parameters like user credentials</param> public static Exceptional<HTTPServer<GraphDSWebDAV_Service>> StartWebDAV(this AGraphDSSharp myAGraphDSSharp, IPAddress myIPAddress, UInt16 myPort, HTTPSecurity myHttpWebSecurity = null) { try { // Initialize WebDAV service var _HttpWebServer = new HTTPServer<GraphDSWebDAV_Service>( myIPAddress, myPort, new GraphDSWebDAV_Service(myAGraphDSSharp), myAutoStart: true) { HTTPSecurity = myHttpWebSecurity, }; // Register the WebDAV service within the list of services // to stop before shutting down the GraphDSSharp instance myAGraphDSSharp.ShutdownEvent += new GraphDSSharp.ShutdownEventHandler((o, e) => { _HttpWebServer.StopAndWait(); }); return new Exceptional<HTTPServer<GraphDSWebDAV_Service>>(_HttpWebServer); } catch (Exception e) { return new Exceptional<HTTPServer<GraphDSWebDAV_Service>>(new GeneralError(e.Message, new System.Diagnostics.StackTrace(e))); } }
public override Exceptional Execute(AGraphDSSharp myAGraphDSSharp, ref String myCurrentPath, Dictionary<String, List<AbstractCLIOption>> myOptions, String myInputString) { if (myAGraphDSSharp == null) return new Exceptional(new GraphDSError("myAGraphDSSharp must not be null!")); var _HttpSecurity = new HTTPSecurity() { // Include: System.ServiceModel CredentialType = HttpClientCredentialType.Basic, UserNamePasswordValidator = new PassValidator() }; // Initialize REST service var _HttpWebServer = new HTTPServer<GraphDSREST_Service>( 9975, new GraphDSREST_Service(myAGraphDSSharp), myAutoStart: true) { HTTPSecurity = _HttpSecurity, }; // Register the REST service within the list of services // to stop before shutting down the GraphDSSharp instance myAGraphDSSharp.ShutdownEvent += new GraphDSSharp.ShutdownEventHandler((o, e) => { _HttpWebServer.StopAndWait(); }); return Exceptional.OK; }
/// <summary> /// Start the WebDAV interface using the given URI and HTTPSecurity parameters. /// </summary> /// <param name="myURI">The URI for binding the interface at</param> /// <param name="myHttpWebSecurity">A HTTPSecurity class for checking security parameters like user credentials</param> public static HTTPServer<GraphDSWebDAV_Service> StartWebDAV(this AGraphDSSharp myAGraphDSSharp, Uri myURI, HTTPSecurity myHttpWebSecurity = null) { // Initialize WebDAV service var _HttpWebServer = new HTTPServer<GraphDSWebDAV_Service>( myURI, new GraphDSWebDAV_Service(myAGraphDSSharp), myAutoStart: true) { HTTPSecurity = myHttpWebSecurity, }; // Register the WebDAV service within the list of services // to stop before shutting down the GraphDSSharp instance myAGraphDSSharp.ShutdownEvent += new GraphDSSharp.ShutdownEventHandler((o, e) => { _HttpWebServer.StopAndWait(); }); return _HttpWebServer; }
/// <summary> /// Start the REST interface using the given ip address, port and HTTPSecurity parameters. /// </summary> /// <param name="myIPAddress">The IPAddress for binding the interface at</param> /// <param name="myPort">The port for binding the interface at</param> /// <param name="myHttpWebSecurity">A HTTPSecurity class for checking security parameters like user credentials</param> public static HTTPServer<GraphDSREST_Service> StartREST(this AGraphDSSharp myAGraphDSSharp, IPAddress myIPAddress, UInt16 myPort, HTTPSecurity myHttpWebSecurity = null) { // Initialize REST service var _HttpWebServer = new HTTPServer<GraphDSREST_Service>( myIPAddress, myPort, new GraphDSREST_Service(myAGraphDSSharp), myAutoStart: true) { HTTPSecurity = myHttpWebSecurity, }; // Register the REST service within the list of services // to stop before shutting down the GraphDSSharp instance myAGraphDSSharp.ShutdownEvent += new GraphDSSharp.ShutdownEventHandler((o, e) => { _HttpWebServer.StopAndWait(); }); return _HttpWebServer; }