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