aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/ConfigurationMember.cs2
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs11
-rwxr-xr-xOpenSim/Framework/Console/ConsoleBase.cs2
-rw-r--r--OpenSim/Framework/ICommandConsole.cs90
-rw-r--r--OpenSim/Framework/IConsole.cs53
-rw-r--r--OpenSim/Framework/IScene.cs4
-rw-r--r--OpenSim/Framework/MainConsole.cs (renamed from OpenSim/Framework/Console/MainConsole.cs)6
-rw-r--r--OpenSim/Framework/RegionInfo.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs38
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs2
-rw-r--r--OpenSim/Framework/Servers/MainServer.cs (renamed from OpenSim/Framework/MainServer.cs)2
-rw-r--r--OpenSim/Framework/WebUtil.cs60
13 files changed, 212 insertions, 64 deletions
diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs
index b4ce877..7afa68a 100644
--- a/OpenSim/Framework/ConfigurationMember.cs
+++ b/OpenSim/Framework/ConfigurationMember.cs
@@ -33,7 +33,7 @@ using System.Reflection;
33using System.Xml; 33using System.Xml;
34using log4net; 34using log4net;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework.Console; 36//using OpenSim.Framework.Console;
37 37
38namespace OpenSim.Framework 38namespace OpenSim.Framework
39{ 39{
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index be36cf2..f10b857 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -33,12 +33,11 @@ using System.Reflection;
33using System.Text; 33using System.Text;
34using System.Threading; 34using System.Threading;
35using log4net; 35using log4net;
36using OpenSim.Framework;
36 37
37namespace OpenSim.Framework.Console 38namespace OpenSim.Framework.Console
38{ 39{
39 public delegate void CommandDelegate(string module, string[] cmd); 40 public class Commands : ICommands
40
41 public class Commands
42 { 41 {
43 /// <summary> 42 /// <summary>
44 /// Encapsulates a command that can be invoked from the console 43 /// Encapsulates a command that can be invoked from the console
@@ -564,14 +563,16 @@ namespace OpenSim.Framework.Console
564 /// <summary> 563 /// <summary>
565 /// A console that processes commands internally 564 /// A console that processes commands internally
566 /// </summary> 565 /// </summary>
567 public class CommandConsole : ConsoleBase 566 public class CommandConsole : ConsoleBase, ICommandConsole
568 { 567 {
569 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 568 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
570 569
571 public Commands Commands = new Commands(); 570 public ICommands Commands { get; private set; }
572 571
573 public CommandConsole(string defaultPrompt) : base(defaultPrompt) 572 public CommandConsole(string defaultPrompt) : base(defaultPrompt)
574 { 573 {
574 Commands = new Commands();
575
575 Commands.AddCommand("console", false, "help", "help [<command>]", 576 Commands.AddCommand("console", false, "help", "help [<command>]",
576 "Get general command list or more detailed help on a specific command", Help); 577 "Get general command list or more detailed help on a specific command", Help);
577 } 578 }
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index c59fbca..4b375d9 100755
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Console
41 41
42 protected string prompt = "# "; 42 protected string prompt = "# ";
43 43
44 public object ConsoleScene = null; 44 public object ConsoleScene { get; set; }
45 45
46 /// <summary> 46 /// <summary>
47 /// The default prompt text. 47 /// The default prompt text.
diff --git a/OpenSim/Framework/ICommandConsole.cs b/OpenSim/Framework/ICommandConsole.cs
new file mode 100644
index 0000000..d33b9b5
--- /dev/null
+++ b/OpenSim/Framework/ICommandConsole.cs
@@ -0,0 +1,90 @@
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
28using System;
29using System.Collections.Generic;
30using System.Xml;
31
32namespace OpenSim.Framework
33{
34 public delegate void CommandDelegate(string module, string[] cmd);
35
36 public interface ICommands
37 {
38 void FromXml(XmlElement root, CommandDelegate fn);
39
40 /// <summary>
41 /// Get help for the given help string
42 /// </summary>
43 /// <param name="helpParts">Parsed parts of the help string. If empty then general help is returned.</param>
44 /// <returns></returns>
45 List<string> GetHelp(string[] cmd);
46
47 /// <summary>
48 /// Add a command to those which can be invoked from the console.
49 /// </summary>
50 /// <param name="module"></param>
51 /// <param name="command"></param>
52 /// <param name="help"></param>
53 /// <param name="longhelp"></param>
54 /// <param name="fn"></param>
55 void AddCommand(string module, bool shared, string command, string help, string longhelp, CommandDelegate fn);
56
57 /// <summary>
58 /// Add a command to those which can be invoked from the console.
59 /// </summary>
60 /// <param name="module"></param>
61 /// <param name="command"></param>
62 /// <param name="help"></param>
63 /// <param name="longhelp"></param>
64 /// <param name="descriptivehelp"></param>
65 /// <param name="fn"></param>
66 void AddCommand(string module, bool shared, string command,
67 string help, string longhelp, string descriptivehelp,
68 CommandDelegate fn);
69
70 string[] FindNextOption(string[] cmd, bool term);
71
72 string[] Resolve(string[] cmd);
73
74 XmlElement GetXml(XmlDocument doc);
75 }
76
77 public interface ICommandConsole : IConsole
78 {
79 ICommands Commands { get; }
80
81 /// <summary>
82 /// Display a command prompt on the console and wait for user input
83 /// </summary>
84 void Prompt();
85
86 void RunCommand(string cmd);
87
88 string ReadLine(string p, bool isCommand, bool e);
89 }
90} \ No newline at end of file
diff --git a/OpenSim/Framework/IConsole.cs b/OpenSim/Framework/IConsole.cs
new file mode 100644
index 0000000..33024b2
--- /dev/null
+++ b/OpenSim/Framework/IConsole.cs
@@ -0,0 +1,53 @@
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
28using System;
29using System.Collections.Generic;
30
31namespace OpenSim.Framework
32{
33 public interface IConsole
34 {
35 object ConsoleScene { get; }
36
37 void Output(string text, string level);
38 void Output(string text);
39 void OutputFormat(string format, params object[] components);
40
41 string CmdPrompt(string p);
42 string CmdPrompt(string p, string def);
43 string CmdPrompt(string p, List<char> excludedCharacters);
44 string CmdPrompt(string p, string def, List<char> excludedCharacters);
45
46 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
47 string CmdPrompt(string prompt, string defaultresponse, List<string> options);
48
49 // Displays a prompt and waits for the user to enter a string, then returns that string
50 // (Done with no echo and suitable for passwords)
51 string PasswdPrompt(string p);
52 }
53} \ No newline at end of file
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index e0cb897..f1b4732 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -26,7 +26,7 @@
26 */ 26 */
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework.Console; 29//using OpenSim.Framework.Console;
30using Nini.Config; 30using Nini.Config;
31 31
32namespace OpenSim.Framework 32namespace OpenSim.Framework
@@ -108,7 +108,7 @@ namespace OpenSim.Framework
108 void RegisterModuleInterface<M>(M mod); 108 void RegisterModuleInterface<M>(M mod);
109 void StackModuleInterface<M>(M mod); 109 void StackModuleInterface<M>(M mod);
110 110
111 void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback); 111// void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback);
112 112
113 ISceneObject DeserializeObject(string representation); 113 ISceneObject DeserializeObject(string representation);
114 114
diff --git a/OpenSim/Framework/Console/MainConsole.cs b/OpenSim/Framework/MainConsole.cs
index 24be617..4527b68 100644
--- a/OpenSim/Framework/Console/MainConsole.cs
+++ b/OpenSim/Framework/MainConsole.cs
@@ -25,13 +25,13 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28namespace OpenSim.Framework.Console 28namespace OpenSim.Framework
29{ 29{
30 public class MainConsole 30 public class MainConsole
31 { 31 {
32 private static CommandConsole instance; 32 private static ICommandConsole instance;
33 33
34 public static CommandConsole Instance 34 public static ICommandConsole Instance
35 { 35 {
36 get { return instance; } 36 get { return instance; }
37 set { instance = value; } 37 set { instance = value; }
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 0e41535..f7c080f 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -36,7 +36,7 @@ using log4net;
36using Nini.Config; 36using Nini.Config;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
39using OpenSim.Framework.Console; 39//using OpenSim.Framework.Console;
40 40
41namespace OpenSim.Framework 41namespace OpenSim.Framework
42{ 42{
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
index 65b1eb5..fd77984 100644
--- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Framework.Servers.HttpServer
49 /// <summary> 49 /// <summary>
50 /// Add a handler for an HTTP request. 50 /// Add a handler for an HTTP request.
51 /// </summary> 51 /// </summary>
52 /// 52 /// <remarks>
53 /// This handler can actually be invoked either as 53 /// This handler can actually be invoked either as
54 /// 54 ///
55 /// http://<hostname>:<port>/?method=<methodName> 55 /// http://<hostname>:<port>/?method=<methodName>
@@ -70,7 +70,7 @@ namespace OpenSim.Framework.Servers.HttpServer
70 /// In addition, the handler invoked by the HTTP server for any request is the one when best matches the request 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 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. 72 /// the "/myapp/" handler is invoked if no "/myapp/page" handler exists.
73 /// 73 /// </remarks>
74 /// <param name="methodName"></param> 74 /// <param name="methodName"></param>
75 /// <param name="handler"></param> 75 /// <param name="handler"></param>
76 /// <returns> 76 /// <returns>
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 0840a9d..ea30b9a 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -31,6 +31,7 @@ using System.Threading;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using HttpServer; 33using HttpServer;
34using OpenSim.Framework;
34 35
35namespace OpenSim.Framework.Servers.HttpServer 36namespace OpenSim.Framework.Servers.HttpServer
36{ 37{
@@ -54,21 +55,25 @@ namespace OpenSim.Framework.Servers.HttpServer
54 m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount]; 55 m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
55 56
56 //startup worker threads 57 //startup worker threads
57 for (uint i=0;i<m_WorkerThreadCount;i++) 58 for (uint i = 0; i < m_WorkerThreadCount; i++)
58 { 59 {
59 m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout); 60 m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout);
60 m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent; 61 m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;
61 62
62 m_workerThreads[i] = new Thread(m_PollServiceWorkerThreads[i].ThreadStart); 63// m_workerThreads[i]
63 m_workerThreads[i].Name = String.Format("PollServiceWorkerThread{0}",i); 64// = Watchdog.StartThread(
64 //Can't add to thread Tracker here Referencing OpenSim.Framework creates circular reference 65// m_PollServiceWorkerThreads[i].ThreadStart,
65 m_workerThreads[i].Start(); 66// String.Format("PollServiceWorkerThread{0}", i),
67// ThreadPriority.Normal,
68// false);
66 } 69 }
67 70
68 //start watcher threads 71 m_watcherThread
69 m_watcherThread = new Thread(ThreadStart); 72 = Watchdog.StartThread(
70 m_watcherThread.Name = "PollServiceWatcherThread"; 73 this.ThreadStart,
71 m_watcherThread.Start(); 74 "PollServiceWatcherThread",
75 ThreadPriority.Normal,
76 false);
72 } 77 }
73 78
74 internal void ReQueueEvent(PollServiceHttpRequest req) 79 internal void ReQueueEvent(PollServiceHttpRequest req)
@@ -83,10 +88,11 @@ namespace OpenSim.Framework.Servers.HttpServer
83 m_requests.Enqueue(req); 88 m_requests.Enqueue(req);
84 } 89 }
85 90
86 public void ThreadStart(object o) 91 public void ThreadStart()
87 { 92 {
88 while (m_running) 93 while (m_running)
89 { 94 {
95 Watchdog.UpdateThread();
90 ProcessQueuedRequests(); 96 ProcessQueuedRequests();
91 Thread.Sleep(1000); 97 Thread.Sleep(1000);
92 } 98 }
@@ -107,7 +113,7 @@ namespace OpenSim.Framework.Servers.HttpServer
107 for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++) 113 for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++)
108 { 114 {
109 //Loop over number of requests each thread handles. 115 //Loop over number of requests each thread handles.
110 for (int i=0;i<reqperthread && m_requests.Count > 0;i++) 116 for (int i = 0; i < reqperthread && m_requests.Count > 0; i++)
111 { 117 {
112 try 118 try
113 { 119 {
@@ -125,14 +131,14 @@ namespace OpenSim.Framework.Servers.HttpServer
125 131
126 } 132 }
127 133
128
129
130 ~PollServiceRequestManager() 134 ~PollServiceRequestManager()
131 { 135 {
132 foreach (object o in m_requests) 136 foreach (object o in m_requests)
133 { 137 {
134 PollServiceHttpRequest req = (PollServiceHttpRequest) o; 138 PollServiceHttpRequest req = (PollServiceHttpRequest) o;
135 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); 139 m_server.DoHTTPGruntWork(
140 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
141 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
136 } 142 }
137 143
138 m_requests.Clear(); 144 m_requests.Clear();
@@ -144,4 +150,4 @@ namespace OpenSim.Framework.Servers.HttpServer
144 m_running = false; 150 m_running = false;
145 } 151 }
146 } 152 }
147} 153} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
index b91496b..16e56d2 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Framework.Servers.HttpServer
59 m_timeout = pTimeout; 59 m_timeout = pTimeout;
60 } 60 }
61 61
62 public void ThreadStart(object o) 62 public void ThreadStart()
63 { 63 {
64 Run(); 64 Run();
65 } 65 }
diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs
index a3e0a26..b8ab8d9 100644
--- a/OpenSim/Framework/MainServer.cs
+++ b/OpenSim/Framework/Servers/MainServer.cs
@@ -31,7 +31,7 @@ using System.Net;
31using log4net; 31using log4net;
32using OpenSim.Framework.Servers.HttpServer; 32using OpenSim.Framework.Servers.HttpServer;
33 33
34namespace OpenSim.Framework 34namespace OpenSim.Framework.Servers
35{ 35{
36 public class MainServer 36 public class MainServer
37 { 37 {
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index be7504f..cafa441 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -39,9 +39,7 @@ using System.Text;
39using System.Web; 39using System.Web;
40using System.Xml; 40using System.Xml;
41using System.Xml.Serialization; 41using System.Xml.Serialization;
42
43using log4net; 42using log4net;
44using OpenSim.Framework.Servers.HttpServer;
45using OpenMetaverse.StructuredData; 43using OpenMetaverse.StructuredData;
46 44
47namespace OpenSim.Framework 45namespace OpenSim.Framework
@@ -65,35 +63,35 @@ namespace OpenSim.Framework
65 // a "long" call for warning & debugging purposes 63 // a "long" call for warning & debugging purposes
66 public const int LongCallTime = 500; 64 public const int LongCallTime = 500;
67 65
68 /// <summary> 66// /// <summary>
69 /// Send LLSD to an HTTP client in application/llsd+json form 67// /// Send LLSD to an HTTP client in application/llsd+json form
70 /// </summary> 68// /// </summary>
71 /// <param name="response">HTTP response to send the data in</param> 69// /// <param name="response">HTTP response to send the data in</param>
72 /// <param name="body">LLSD to send to the client</param> 70// /// <param name="body">LLSD to send to the client</param>
73 public static void SendJSONResponse(OSHttpResponse response, OSDMap body) 71// public static void SendJSONResponse(OSHttpResponse response, OSDMap body)
74 { 72// {
75 byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body)); 73// byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body));
76 74//
77 response.ContentEncoding = Encoding.UTF8; 75// response.ContentEncoding = Encoding.UTF8;
78 response.ContentLength = responseData.Length; 76// response.ContentLength = responseData.Length;
79 response.ContentType = "application/llsd+json"; 77// response.ContentType = "application/llsd+json";
80 response.Body.Write(responseData, 0, responseData.Length); 78// response.Body.Write(responseData, 0, responseData.Length);
81 } 79// }
82 80//
83 /// <summary> 81// /// <summary>
84 /// Send LLSD to an HTTP client in application/llsd+xml form 82// /// Send LLSD to an HTTP client in application/llsd+xml form
85 /// </summary> 83// /// </summary>
86 /// <param name="response">HTTP response to send the data in</param> 84// /// <param name="response">HTTP response to send the data in</param>
87 /// <param name="body">LLSD to send to the client</param> 85// /// <param name="body">LLSD to send to the client</param>
88 public static void SendXMLResponse(OSHttpResponse response, OSDMap body) 86// public static void SendXMLResponse(OSHttpResponse response, OSDMap body)
89 { 87// {
90 byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body); 88// byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body);
91 89//
92 response.ContentEncoding = Encoding.UTF8; 90// response.ContentEncoding = Encoding.UTF8;
93 response.ContentLength = responseData.Length; 91// response.ContentLength = responseData.Length;
94 response.ContentType = "application/llsd+xml"; 92// response.ContentType = "application/llsd+xml";
95 response.Body.Write(responseData, 0, responseData.Length); 93// response.Body.Write(responseData, 0, responseData.Length);
96 } 94// }
97 95
98 /// <summary> 96 /// <summary>
99 /// Make a GET or GET-like request to a web service that returns LLSD 97 /// Make a GET or GET-like request to a web service that returns LLSD