aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-03-19 18:11:44 +0000
committerJustin Clarke Casey2009-03-19 18:11:44 +0000
commitbd2180d9af21dd54d4199a9381afa3e43e913823 (patch)
tree7f82f0dd30e24d8eaa4f8cbb2493cb2f3f1c637f /OpenSim/Framework/Servers/Interfaces/IHttpServer.cs
parent* Lock http handlers dictionary in other places as well to avoid race conditions (diff)
downloadopensim-SC-bd2180d9af21dd54d4199a9381afa3e43e913823.zip
opensim-SC-bd2180d9af21dd54d4199a9381afa3e43e913823.tar.gz
opensim-SC-bd2180d9af21dd54d4199a9381afa3e43e913823.tar.bz2
opensim-SC-bd2180d9af21dd54d4199a9381afa3e43e913823.tar.xz
* refactor: Create IHttpServer interface instead of accessing BaseHttpServer via CommunicationsManager directly
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/Interfaces/IHttpServer.cs127
1 files changed, 127 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs
new file mode 100644
index 0000000..ea2c8f1
--- /dev/null
+++ b/OpenSim/Framework/Servers/Interfaces/IHttpServer.cs
@@ -0,0 +1,127 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using Nwc.XmlRpc;
29using OpenSim.Framework.Servers;
30
31namespace OpenSim.Framework.Servers.Interfaces
32{
33 /// <summary>
34 /// Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.)
35 /// for given URLs.
36 /// </summary>
37 public interface IHttpServer
38 {
39 uint SSLPort { get; }
40 string SSLCommonName { get; }
41
42 uint Port { get; }
43 bool UseSSL { get; }
44
45 // Note that the agent string is provided simply to differentiate
46 // the handlers - it is NOT required to be an actual agent header
47 // value.
48 bool AddAgentHandler(string agent, IHttpAgentHandler handler);
49
50 /// <summary>
51 /// Add a handler for an HTTP request
52 /// </summary>
53 ///
54 /// This handler can actually be invoked either as
55 ///
56 /// http://<hostname>:<port>/?method=<methodName>
57 ///
58 /// or
59 ///
60 /// http://<hostname>:<port><method>
61 ///
62 /// if the method name starts with a slash. For example, AddHTTPHandler("/object/", ...) on a standalone region
63 /// server will register a handler that can be invoked with either
64 ///
65 /// http://localhost:9000/?method=/object/
66 ///
67 /// or
68 ///
69 /// http://localhost:9000/object/
70 ///
71 /// <param name="methodName"></param>
72 /// <param name="handler"></param>
73 /// <returns>
74 /// true if the handler was successfully registered, false if a handler with the same name already existed.
75 /// </returns>
76 bool AddHTTPHandler(string methodName, GenericHTTPMethod handler);
77
78 /// <summary>
79 /// Adds a LLSD handler, yay.
80 /// </summary>
81 /// <param name="path">/resource/ path</param>
82 /// <param name="handler">handle the LLSD response</param>
83 /// <returns></returns>
84 bool AddLLSDHandler(string path, LLSDMethod handler);
85
86 /// <summary>
87 /// Add a stream handler to the http server. If the handler already exists, then nothing happens.
88 /// </summary>
89 /// <param name="handler"></param>
90 void AddStreamHandler(IRequestHandler handler);
91
92 bool AddXmlRPCHandler(string method, XmlRpcMethod handler);
93 bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive);
94
95 /// <summary>
96 /// Gets the XML RPC handler for given method name
97 /// </summary>
98 /// <param name="method">Name of the method</param>
99 /// <returns>Returns null if not found</returns>
100 XmlRpcMethod GetXmlRPCHandler(string method);
101
102 bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
103
104 /// <summary>
105 /// Remove the agent if it is registered.
106 /// </summary>
107 /// <param name="agent"></param>
108 /// <param name="handler"></param>
109 /// <returns></returns>
110 bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
111
112 /// <summary>
113 /// Remove an HTTP handler
114 /// </summary>
115 /// <param name="httpMethod"></param>
116 /// <param name="path"></param>
117 void RemoveHTTPHandler(string httpMethod, string path);
118
119 bool RemoveLLSDHandler(string path, LLSDMethod handler);
120
121 void RemoveStreamHandler(string httpMethod, string path);
122
123 string GetHTTP404(string host);
124
125 string GetHTTP500();
126 }
127} \ No newline at end of file