本文整理汇总了C#中HttpServer.AddHandler方法的典型用法代码示例。如果您正苦于以下问题:C# HttpServer.AddHandler方法的具体用法?C# HttpServer.AddHandler怎么用?C# HttpServer.AddHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpServer
的用法示例。
在下文中一共展示了HttpServer.AddHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EventQueueServer
public EventQueueServer(HttpServer server, string path)
{
HttpRequestSignature signature = new HttpRequestSignature();
signature.Method = "post";
signature.ContentType = String.Empty;
signature.Path = path;
HttpServer.HttpRequestCallback callback = new HttpServer.HttpRequestCallback(EventQueueHandler);
HttpServer.HttpRequestHandler handler = new HttpServer.HttpRequestHandler(signature, callback);
server.AddHandler(handler);
}
示例2: InitHttpServer
void InitHttpServer(int port, bool ssl)
{
HttpServer = new HttpServer(HttpPort, ssl);
// Login webpage HEAD request, used to check if the login webpage is alive
HttpServer.AddHandler("head", null, "^/loginpage", new HttpServer.HttpRequestCallback(LoginWebpageHeadHandler));
// Login webpage GET request, gets the login webpage data (purely aesthetic)
HttpServer.AddHandler("get", null, "^/loginpage", new HttpServer.HttpRequestCallback(LoginWebpageGetHandler));
// Client XML-RPC login
HttpServer.AddHandler("post", "text/xml", "^/login", new HttpServer.HttpRequestCallback(LoginXmlRpcPostHandler));
// Client LLSD login
HttpServer.AddHandler("post", "application/xml", "^/login", new HttpServer.HttpRequestCallback(LoginLLSDPostHandler));
HttpServer.Start();
}
示例3: InitHttpServer
void InitHttpServer(int port, bool ssl)
{
HttpServer = new HttpServer(tcpPort, ssl);
// Login webpage HEAD request, used to check if the login webpage is alive
HttpRequestSignature signature = new HttpRequestSignature();
signature.Method = "head";
signature.ContentType = String.Empty;
signature.Path = "/loginpage";
HttpServer.HttpRequestCallback callback = new HttpServer.HttpRequestCallback(LoginWebpageHeadHandler);
HttpServer.HttpRequestHandler handler = new HttpServer.HttpRequestHandler(signature, callback);
HttpServer.AddHandler(handler);
// Login webpage GET request, gets the login webpage data (purely aesthetic)
signature.Method = "get";
signature.ContentType = String.Empty;
signature.Path = "/loginpage";
callback = new HttpServer.HttpRequestCallback(LoginWebpageGetHandler);
handler.Signature = signature;
handler.Callback = callback;
HttpServer.AddHandler(handler);
// Client XML-RPC login
signature.Method = "post";
signature.ContentType = "text/xml";
signature.Path = "/login";
callback = new HttpServer.HttpRequestCallback(LoginXmlRpcPostHandler);
handler.Signature = signature;
handler.Callback = callback;
HttpServer.AddHandler(handler);
// Client LLSD login
signature.Method = "post";
signature.ContentType = "application/xml";
signature.Path = "/login";
callback = new HttpServer.HttpRequestCallback(LoginLLSDPostHandler);
handler.Signature = signature;
handler.Callback = callback;
HttpServer.AddHandler(handler);
HttpServer.Start();
}