aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/Framework/XMPPHTTPService.cs
diff options
context:
space:
mode:
authorMW2009-02-24 14:00:29 +0000
committerMW2009-02-24 14:00:29 +0000
commitbafbfcf09086113bb15eb419f4dcb2629def7a81 (patch)
tree60c0fa5ca4769e63eae7f64a397a150ca4934335 /OpenSim/Grid/Framework/XMPPHTTPService.cs
parentAdded OpenSim.Grid.Framework project. (diff)
downloadopensim-SC_OLD-bafbfcf09086113bb15eb419f4dcb2629def7a81.zip
opensim-SC_OLD-bafbfcf09086113bb15eb419f4dcb2629def7a81.tar.gz
opensim-SC_OLD-bafbfcf09086113bb15eb419f4dcb2629def7a81.tar.bz2
opensim-SC_OLD-bafbfcf09086113bb15eb419f4dcb2629def7a81.tar.xz
Some cleaning up in the MesssagingServer and GridServer.
Diffstat (limited to 'OpenSim/Grid/Framework/XMPPHTTPService.cs')
-rw-r--r--OpenSim/Grid/Framework/XMPPHTTPService.cs110
1 files changed, 110 insertions, 0 deletions
diff --git a/OpenSim/Grid/Framework/XMPPHTTPService.cs b/OpenSim/Grid/Framework/XMPPHTTPService.cs
new file mode 100644
index 0000000..bb09c8a
--- /dev/null
+++ b/OpenSim/Grid/Framework/XMPPHTTPService.cs
@@ -0,0 +1,110 @@
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 System;
29using System.IO;
30using System.Reflection;
31using log4net;
32using OpenMetaverse;
33using OpenSim.Framework.Servers;
34
35namespace OpenSim.Grid.Framework
36{
37 public class XMPPHTTPStreamHandler : BaseStreamHandler
38 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40
41
42 /// <summary>
43 /// Constructor.
44 /// </summary>
45 /// <param name="assetManager"></param>
46 /// <param name="assetProvider"></param>
47 public XMPPHTTPStreamHandler()
48 : base("GET", "/presence")
49 {
50 m_log.Info("[REST]: In Get Request");
51
52 }
53
54 public override byte[] Handle(string path, Stream request,
55 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
56 {
57 string param = GetParam(path);
58 byte[] result = new byte[] {};
59 try
60 {
61 string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
62
63 if (p.Length > 0)
64 {
65 UUID assetID = UUID.Zero;
66
67 if (!UUID.TryParse(p[0], out assetID))
68 {
69 m_log.InfoFormat(
70 "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]);
71 return result;
72 }
73
74 }
75 }
76 catch (Exception e)
77 {
78 m_log.Error(e.ToString());
79 }
80 return result;
81 }
82 }
83
84 public class PostXMPPStreamHandler : BaseStreamHandler
85 {
86 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
87
88 public override byte[] Handle(string path, Stream request,
89 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
90 {
91 string param = GetParam(path);
92
93 UUID assetId;
94 if (param.Length > 0)
95 UUID.TryParse(param, out assetId);
96 // byte[] txBuffer = new byte[4096];
97
98 // TODO: Read POST serialize XMPP stanzas
99
100 return new byte[] {};
101 }
102
103 public PostXMPPStreamHandler()
104 : base("POST", "/presence")
105 {
106
107 }
108
109 }
110}