aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/PostAssetStreamHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers/PostAssetStreamHandler.cs')
-rw-r--r--OpenSim/Framework/Servers/PostAssetStreamHandler.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/PostAssetStreamHandler.cs b/OpenSim/Framework/Servers/PostAssetStreamHandler.cs
new file mode 100644
index 0000000..6e96361
--- /dev/null
+++ b/OpenSim/Framework/Servers/PostAssetStreamHandler.cs
@@ -0,0 +1,45 @@
1using System.IO;
2using System.Reflection;
3using System.Xml.Serialization;
4using log4net;
5using OpenMetaverse;
6using OpenSim.Data;
7using OpenSim.Framework;
8using OpenSim.Framework.Servers;
9
10namespace OpenSim.Framework.Servers
11{
12 public class PostAssetStreamHandler : BaseStreamHandler
13 {
14 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
15
16 // private OpenAsset_Main m_assetManager;
17 private IAssetDataPlugin m_assetProvider;
18
19 public override byte[] Handle(string path, Stream request,
20 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
21 {
22 string param = GetParam(path);
23
24 UUID assetId;
25 if (param.Length > 0)
26 UUID.TryParse(param, out assetId);
27 // byte[] txBuffer = new byte[4096];
28
29 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
30 AssetBase asset = (AssetBase) xs.Deserialize(request);
31
32 m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID);
33 m_assetProvider.CreateAsset(asset);
34
35 return new byte[] {};
36 }
37
38 public PostAssetStreamHandler(IAssetDataPlugin assetProvider)
39 : base("POST", "/assets")
40 {
41 // m_assetManager = assetManager;
42 m_assetProvider = assetProvider;
43 }
44 }
45} \ No newline at end of file