opensim – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | eva | 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 OpenSimulator 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 | |||
28 | using Nwc.XmlRpc; |
||
29 | |||
30 | namespace OpenSim.Framework.Servers.HttpServer |
||
31 | { |
||
32 | /// <summary> |
||
33 | /// Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) |
||
34 | /// for given URLs. |
||
35 | /// </summary> |
||
36 | public interface IHttpServer |
||
37 | { |
||
38 | uint SSLPort { get; } |
||
39 | string SSLCommonName { get; } |
||
40 | |||
41 | uint Port { get; } |
||
42 | bool UseSSL { get; } |
||
43 | |||
44 | // // Note that the agent string is provided simply to differentiate |
||
45 | // // the handlers - it is NOT required to be an actual agent header |
||
46 | // // value. |
||
47 | // bool AddAgentHandler(string agent, IHttpAgentHandler handler); |
||
48 | |||
49 | /// <summary> |
||
50 | /// Add a handler for an HTTP request. |
||
51 | /// </summary> |
||
52 | /// <remarks> |
||
53 | /// This handler can actually be invoked either as |
||
54 | /// |
||
55 | /// http://<hostname>:<port>/?method=<methodName> |
||
56 | /// |
||
57 | /// or |
||
58 | /// |
||
59 | /// http://<hostname>:<port><method> |
||
60 | /// |
||
61 | /// if the method name starts with a slash. For example, AddHTTPHandler("/object/", ...) on a standalone region |
||
62 | /// server will register a handler that can be invoked with either |
||
63 | /// |
||
64 | /// http://localhost:9000/?method=/object/ |
||
65 | /// |
||
66 | /// or |
||
67 | /// |
||
68 | /// http://localhost:9000/object/ |
||
69 | /// |
||
70 | /// In addition, the handler invoked by the HTTP server for any request is the one when best matches the request |
||
71 | /// URI. So if a handler for "/myapp/" is registered and a request for "/myapp/page" is received, then |
||
72 | /// the "/myapp/" handler is invoked if no "/myapp/page" handler exists. |
||
73 | /// </remarks> |
||
74 | /// <param name="methodName"></param> |
||
75 | /// <param name="handler"></param> |
||
76 | /// <returns> |
||
77 | /// true if the handler was successfully registered, false if a handler with the same name already existed. |
||
78 | /// </returns> |
||
79 | bool AddHTTPHandler(string methodName, GenericHTTPMethod handler); |
||
80 | |||
81 | bool AddPollServiceHTTPHandler(string methodName, PollServiceEventArgs args); |
||
82 | |||
83 | /// <summary> |
||
84 | /// Adds a LLSD handler, yay. |
||
85 | /// </summary> |
||
86 | /// <param name="path">/resource/ path</param> |
||
87 | /// <param name="handler">handle the LLSD response</param> |
||
88 | /// <returns></returns> |
||
89 | bool AddLLSDHandler(string path, LLSDMethod handler); |
||
90 | |||
91 | /// <summary> |
||
92 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. |
||
93 | /// </summary> |
||
94 | /// <param name="handler"></param> |
||
95 | void AddStreamHandler(IRequestHandler handler); |
||
96 | |||
97 | bool AddXmlRPCHandler(string method, XmlRpcMethod handler); |
||
98 | bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive); |
||
99 | |||
100 | bool AddJsonRPCHandler(string method, JsonRPCMethod handler); |
||
101 | |||
102 | /// <summary> |
||
103 | /// Websocket HTTP server handlers. |
||
104 | /// </summary> |
||
105 | /// <param name="servicepath"></param> |
||
106 | /// <param name="handler"></param> |
||
107 | void AddWebSocketHandler(string servicepath, BaseHttpServer.WebSocketRequestDelegate handler); |
||
108 | |||
109 | |||
110 | void RemoveWebSocketHandler(string servicepath); |
||
111 | |||
112 | /// <summary> |
||
113 | /// Gets the XML RPC handler for given method name |
||
114 | /// </summary> |
||
115 | /// <param name="method">Name of the method</param> |
||
116 | /// <returns>Returns null if not found</returns> |
||
117 | XmlRpcMethod GetXmlRPCHandler(string method); |
||
118 | |||
119 | bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); |
||
120 | |||
121 | // /// <summary> |
||
122 | // /// Remove the agent if it is registered. |
||
123 | // /// </summary> |
||
124 | // /// <param name="agent"></param> |
||
125 | // /// <param name="handler"></param> |
||
126 | // /// <returns></returns> |
||
127 | // bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); |
||
128 | |||
129 | /// <summary> |
||
130 | /// Remove an HTTP handler |
||
131 | /// </summary> |
||
132 | /// <param name="httpMethod"></param> |
||
133 | /// <param name="path"></param> |
||
134 | void RemoveHTTPHandler(string httpMethod, string path); |
||
135 | |||
136 | void RemovePollServiceHTTPHandler(string httpMethod, string path); |
||
137 | |||
138 | bool RemoveLLSDHandler(string path, LLSDMethod handler); |
||
139 | |||
140 | void RemoveStreamHandler(string httpMethod, string path); |
||
141 | |||
142 | void RemoveXmlRPCHandler(string method); |
||
143 | |||
144 | void RemoveJsonRPCHandler(string method); |
||
145 | |||
146 | string GetHTTP404(string host); |
||
147 | |||
148 | string GetHTTP500(); |
||
149 | } |
||
150 | } |