diff options
author | BlueWall | 2012-03-02 15:02:09 -0500 |
---|---|---|
committer | BlueWall | 2012-03-02 15:02:09 -0500 |
commit | 6fc350725da5132eefe14897644d672ce586c5db (patch) | |
tree | d73af5d1d9bc61143fbac24a4dd54256a1394c97 /OpenSim/Framework | |
parent | Merge branch 'master' of /home/opensim/src/opensim into v3_support (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-6fc350725da5132eefe14897644d672ce586c5db.zip opensim-SC_OLD-6fc350725da5132eefe14897644d672ce586c5db.tar.gz opensim-SC_OLD-6fc350725da5132eefe14897644d672ce586c5db.tar.bz2 opensim-SC_OLD-6fc350725da5132eefe14897644d672ce586c5db.tar.xz |
Merge branch 'master' into v3_support
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Console/MockConsole.cs | 59 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/VersionInfo.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 78 |
3 files changed, 45 insertions, 94 deletions
diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs index a29b370..4d8751f 100644 --- a/OpenSim/Framework/Console/MockConsole.cs +++ b/OpenSim/Framework/Console/MockConsole.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Threading; | 29 | using System.Threading; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using System.Xml; | ||
32 | 33 | ||
33 | namespace OpenSim.Framework.Console | 34 | namespace OpenSim.Framework.Console |
34 | { | 35 | { |
@@ -37,28 +38,42 @@ namespace OpenSim.Framework.Console | |||
37 | /// Don't use this except for Unit Testing or you're in for a world of hurt when the | 38 | /// Don't use this except for Unit Testing or you're in for a world of hurt when the |
38 | /// sim gets to ReadLine | 39 | /// sim gets to ReadLine |
39 | /// </summary> | 40 | /// </summary> |
40 | public class MockConsole : CommandConsole | 41 | public class MockConsole : ICommandConsole |
41 | { | 42 | { |
42 | public MockConsole(string defaultPrompt) : base(defaultPrompt) | 43 | private MockCommands m_commands = new MockCommands(); |
43 | { | ||
44 | } | ||
45 | public override void Output(string text) | ||
46 | { | ||
47 | } | ||
48 | public override void Output(string text, string level) | ||
49 | { | ||
50 | } | ||
51 | 44 | ||
52 | public override string ReadLine(string p, bool isCommand, bool e) | 45 | public ICommands Commands { get { return m_commands; } } |
53 | { | 46 | |
54 | //Thread.CurrentThread.Join(1000); | 47 | public void Prompt() {} |
55 | return string.Empty; | 48 | |
56 | } | 49 | public void RunCommand(string cmd) {} |
57 | public override void UnlockOutput() | 50 | |
58 | { | 51 | public string ReadLine(string p, bool isCommand, bool e) { return ""; } |
59 | } | 52 | |
60 | public override void LockOutput() | 53 | public object ConsoleScene { get { return null; } } |
61 | { | 54 | |
62 | } | 55 | public void Output(string text, string level) {} |
56 | public void Output(string text) {} | ||
57 | public void OutputFormat(string format, params object[] components) {} | ||
58 | |||
59 | public string CmdPrompt(string p) { return ""; } | ||
60 | public string CmdPrompt(string p, string def) { return ""; } | ||
61 | public string CmdPrompt(string p, List<char> excludedCharacters) { return ""; } | ||
62 | public string CmdPrompt(string p, string def, List<char> excludedCharacters) { return ""; } | ||
63 | |||
64 | public string CmdPrompt(string prompt, string defaultresponse, List<string> options) { return ""; } | ||
65 | |||
66 | public string PasswdPrompt(string p) { return ""; } | ||
67 | } | ||
68 | |||
69 | public class MockCommands : ICommands | ||
70 | { | ||
71 | public void FromXml(XmlElement root, CommandDelegate fn) {} | ||
72 | public List<string> GetHelp(string[] cmd) { return null; } | ||
73 | public void AddCommand(string module, bool shared, string command, string help, string longhelp, CommandDelegate fn) {} | ||
74 | public void AddCommand(string module, bool shared, string command, string help, string longhelp, string descriptivehelp, CommandDelegate fn) {} | ||
75 | public string[] FindNextOption(string[] cmd, bool term) { return null; } | ||
76 | public string[] Resolve(string[] cmd) { return null; } | ||
77 | public XmlElement GetXml(XmlDocument doc) { return null; } | ||
63 | } | 78 | } |
64 | } | 79 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index f30cb7a..7a5d715 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs | |||
@@ -29,7 +29,7 @@ namespace OpenSim | |||
29 | { | 29 | { |
30 | public class VersionInfo | 30 | public class VersionInfo |
31 | { | 31 | { |
32 | private const string VERSION_NUMBER = "0.7.3"; | 32 | private const string VERSION_NUMBER = "0.7.4"; |
33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; | 33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; |
34 | 34 | ||
35 | public enum Flavour | 35 | public enum Flavour |
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index b761dfe..af25da9 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -63,77 +63,7 @@ namespace OpenSim.Framework | |||
63 | // a "long" call for warning & debugging purposes | 63 | // a "long" call for warning & debugging purposes |
64 | public const int LongCallTime = 500; | 64 | public const int LongCallTime = 500; |
65 | 65 | ||
66 | // /// <summary> | 66 | #region JSONRequest |
67 | // /// Send LLSD to an HTTP client in application/llsd+json form | ||
68 | // /// </summary> | ||
69 | // /// <param name="response">HTTP response to send the data in</param> | ||
70 | // /// <param name="body">LLSD to send to the client</param> | ||
71 | // public static void SendJSONResponse(OSHttpResponse response, OSDMap body) | ||
72 | // { | ||
73 | // byte[] responseData = Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(body)); | ||
74 | // | ||
75 | // response.ContentEncoding = Encoding.UTF8; | ||
76 | // response.ContentLength = responseData.Length; | ||
77 | // response.ContentType = "application/llsd+json"; | ||
78 | // response.Body.Write(responseData, 0, responseData.Length); | ||
79 | // } | ||
80 | // | ||
81 | // /// <summary> | ||
82 | // /// Send LLSD to an HTTP client in application/llsd+xml form | ||
83 | // /// </summary> | ||
84 | // /// <param name="response">HTTP response to send the data in</param> | ||
85 | // /// <param name="body">LLSD to send to the client</param> | ||
86 | // public static void SendXMLResponse(OSHttpResponse response, OSDMap body) | ||
87 | // { | ||
88 | // byte[] responseData = OSDParser.SerializeLLSDXmlBytes(body); | ||
89 | // | ||
90 | // response.ContentEncoding = Encoding.UTF8; | ||
91 | // response.ContentLength = responseData.Length; | ||
92 | // response.ContentType = "application/llsd+xml"; | ||
93 | // response.Body.Write(responseData, 0, responseData.Length); | ||
94 | // } | ||
95 | |||
96 | /// <summary> | ||
97 | /// Make a GET or GET-like request to a web service that returns LLSD | ||
98 | /// or JSON data | ||
99 | /// </summary> | ||
100 | public static OSDMap ServiceRequest(string url, string httpVerb) | ||
101 | { | ||
102 | string errorMessage; | ||
103 | |||
104 | try | ||
105 | { | ||
106 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); | ||
107 | request.Method = httpVerb; | ||
108 | |||
109 | using (WebResponse response = request.GetResponse()) | ||
110 | { | ||
111 | using (Stream responseStream = response.GetResponseStream()) | ||
112 | { | ||
113 | try | ||
114 | { | ||
115 | string responseStr = responseStream.GetStreamString(); | ||
116 | OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
117 | if (responseOSD.Type == OSDType.Map) | ||
118 | return (OSDMap)responseOSD; | ||
119 | else | ||
120 | errorMessage = "Response format was invalid."; | ||
121 | } | ||
122 | catch | ||
123 | { | ||
124 | errorMessage = "Failed to parse the response."; | ||
125 | } | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | catch (Exception ex) | ||
130 | { | ||
131 | m_log.Warn(httpVerb + " on URL " + url + " failed: " + ex.Message); | ||
132 | errorMessage = ex.Message; | ||
133 | } | ||
134 | |||
135 | return new OSDMap { { "Message", OSD.FromString("Service request failed. " + errorMessage) } }; | ||
136 | } | ||
137 | 67 | ||
138 | /// <summary> | 68 | /// <summary> |
139 | /// PUT JSON-encoded data to a web service that returns LLSD or | 69 | /// PUT JSON-encoded data to a web service that returns LLSD or |
@@ -303,6 +233,10 @@ namespace OpenSim.Framework | |||
303 | return result; | 233 | return result; |
304 | } | 234 | } |
305 | 235 | ||
236 | #endregion JSONRequest | ||
237 | |||
238 | #region FormRequest | ||
239 | |||
306 | /// <summary> | 240 | /// <summary> |
307 | /// POST URL-encoded form data to a web service that returns LLSD or | 241 | /// POST URL-encoded form data to a web service that returns LLSD or |
308 | /// JSON data | 242 | /// JSON data |
@@ -397,6 +331,8 @@ namespace OpenSim.Framework | |||
397 | result["Message"] = OSD.FromString("Service request failed: " + msg); | 331 | result["Message"] = OSD.FromString("Service request failed: " + msg); |
398 | return result; | 332 | return result; |
399 | } | 333 | } |
334 | |||
335 | #endregion FormRequest | ||
400 | 336 | ||
401 | #region Uri | 337 | #region Uri |
402 | 338 | ||