diff options
Diffstat (limited to 'OpenSim/Grid/Framework/XMPPHTTPService.cs')
-rw-r--r-- | OpenSim/Grid/Framework/XMPPHTTPService.cs | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/OpenSim/Grid/Framework/XMPPHTTPService.cs b/OpenSim/Grid/Framework/XMPPHTTPService.cs index bb09c8a..e87c2be 100644 --- a/OpenSim/Grid/Framework/XMPPHTTPService.cs +++ b/OpenSim/Grid/Framework/XMPPHTTPService.cs | |||
@@ -1,110 +1,110 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework.Servers; | 33 | using OpenSim.Framework.Servers; |
34 | 34 | ||
35 | namespace OpenSim.Grid.Framework | 35 | namespace OpenSim.Grid.Framework |
36 | { | 36 | { |
37 | public class XMPPHTTPStreamHandler : BaseStreamHandler | 37 | public class XMPPHTTPStreamHandler : BaseStreamHandler |
38 | { | 38 | { |
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
40 | 40 | ||
41 | 41 | ||
42 | /// <summary> | 42 | /// <summary> |
43 | /// Constructor. | 43 | /// Constructor. |
44 | /// </summary> | 44 | /// </summary> |
45 | /// <param name="assetManager"></param> | 45 | /// <param name="assetManager"></param> |
46 | /// <param name="assetProvider"></param> | 46 | /// <param name="assetProvider"></param> |
47 | public XMPPHTTPStreamHandler() | 47 | public XMPPHTTPStreamHandler() |
48 | : base("GET", "/presence") | 48 | : base("GET", "/presence") |
49 | { | 49 | { |
50 | m_log.Info("[REST]: In Get Request"); | 50 | m_log.Info("[REST]: In Get Request"); |
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
54 | public override byte[] Handle(string path, Stream request, | 54 | public override byte[] Handle(string path, Stream request, |
55 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 55 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
56 | { | 56 | { |
57 | string param = GetParam(path); | 57 | string param = GetParam(path); |
58 | byte[] result = new byte[] {}; | 58 | byte[] result = new byte[] {}; |
59 | try | 59 | try |
60 | { | 60 | { |
61 | string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); | 61 | string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); |
62 | 62 | ||
63 | if (p.Length > 0) | 63 | if (p.Length > 0) |
64 | { | 64 | { |
65 | UUID assetID = UUID.Zero; | 65 | UUID assetID = UUID.Zero; |
66 | 66 | ||
67 | if (!UUID.TryParse(p[0], out assetID)) | 67 | if (!UUID.TryParse(p[0], out assetID)) |
68 | { | 68 | { |
69 | m_log.InfoFormat( | 69 | m_log.InfoFormat( |
70 | "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); | 70 | "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); |
71 | return result; | 71 | return result; |
72 | } | 72 | } |
73 | 73 | ||
74 | } | 74 | } |
75 | } | 75 | } |
76 | catch (Exception e) | 76 | catch (Exception e) |
77 | { | 77 | { |
78 | m_log.Error(e.ToString()); | 78 | m_log.Error(e.ToString()); |
79 | } | 79 | } |
80 | return result; | 80 | return result; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | public class PostXMPPStreamHandler : BaseStreamHandler | 84 | public class PostXMPPStreamHandler : BaseStreamHandler |
85 | { | 85 | { |
86 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 86 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
87 | 87 | ||
88 | public override byte[] Handle(string path, Stream request, | 88 | public override byte[] Handle(string path, Stream request, |
89 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 89 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
90 | { | 90 | { |
91 | string param = GetParam(path); | 91 | string param = GetParam(path); |
92 | 92 | ||
93 | UUID assetId; | 93 | UUID assetId; |
94 | if (param.Length > 0) | 94 | if (param.Length > 0) |
95 | UUID.TryParse(param, out assetId); | 95 | UUID.TryParse(param, out assetId); |
96 | // byte[] txBuffer = new byte[4096]; | 96 | // byte[] txBuffer = new byte[4096]; |
97 | 97 | ||
98 | // TODO: Read POST serialize XMPP stanzas | 98 | // TODO: Read POST serialize XMPP stanzas |
99 | 99 | ||
100 | return new byte[] {}; | 100 | return new byte[] {}; |
101 | } | 101 | } |
102 | 102 | ||
103 | public PostXMPPStreamHandler() | 103 | public PostXMPPStreamHandler() |
104 | : base("POST", "/presence") | 104 | : base("POST", "/presence") |
105 | { | 105 | { |
106 | 106 | ||
107 | } | 107 | } |
108 | 108 | ||
109 | } | 109 | } |
110 | } | 110 | } |