diff options
author | lbsa71 | 2009-02-19 18:53:43 +0000 |
---|---|---|
committer | lbsa71 | 2009-02-19 18:53:43 +0000 |
commit | 00a5fb9484592d8d37b38cebd96d0f399bbe4ebf (patch) | |
tree | 13005261c263ecb09857e92fd0c9b8ae05afec8c /OpenSim/Grid/AssetServer/PostAssetStreamHandler.cs | |
parent | * Changed Prebuild.xml back to specifying xmlns (diff) | |
download | opensim-SC_OLD-00a5fb9484592d8d37b38cebd96d0f399bbe4ebf.zip opensim-SC_OLD-00a5fb9484592d8d37b38cebd96d0f399bbe4ebf.tar.gz opensim-SC_OLD-00a5fb9484592d8d37b38cebd96d0f399bbe4ebf.tar.bz2 opensim-SC_OLD-00a5fb9484592d8d37b38cebd96d0f399bbe4ebf.tar.xz |
* Split RestService.cs into GetAssetStreamHandler.cs and PostAssetStreamHandler.cs - then killed off original (misnomed) file.
* Really, who wrote this jurassic shit code all with totally wrong file names? Ah yeah, that'd be me. Sorry.
Diffstat (limited to 'OpenSim/Grid/AssetServer/PostAssetStreamHandler.cs')
-rw-r--r-- | OpenSim/Grid/AssetServer/PostAssetStreamHandler.cs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Grid/AssetServer/PostAssetStreamHandler.cs b/OpenSim/Grid/AssetServer/PostAssetStreamHandler.cs new file mode 100644 index 0000000..69551d8 --- /dev/null +++ b/OpenSim/Grid/AssetServer/PostAssetStreamHandler.cs | |||
@@ -0,0 +1,44 @@ | |||
1 | using System.IO; | ||
2 | using System.Reflection; | ||
3 | using System.Xml.Serialization; | ||
4 | using log4net; | ||
5 | using OpenMetaverse; | ||
6 | using OpenSim.Framework; | ||
7 | using OpenSim.Framework.Servers; | ||
8 | |||
9 | namespace OpenSim.Grid.AssetServer | ||
10 | { | ||
11 | public class PostAssetStreamHandler : BaseStreamHandler | ||
12 | { | ||
13 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
14 | |||
15 | // private OpenAsset_Main m_assetManager; | ||
16 | private IAssetDataPlugin m_assetProvider; | ||
17 | |||
18 | public override byte[] Handle(string path, Stream request, | ||
19 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
20 | { | ||
21 | string param = GetParam(path); | ||
22 | |||
23 | UUID assetId; | ||
24 | if (param.Length > 0) | ||
25 | UUID.TryParse(param, out assetId); | ||
26 | // byte[] txBuffer = new byte[4096]; | ||
27 | |||
28 | XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); | ||
29 | AssetBase asset = (AssetBase) xs.Deserialize(request); | ||
30 | |||
31 | m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID); | ||
32 | m_assetProvider.CreateAsset(asset); | ||
33 | |||
34 | return new byte[] {}; | ||
35 | } | ||
36 | |||
37 | public PostAssetStreamHandler(IAssetDataPlugin assetProvider) | ||
38 | : base("POST", "/assets") | ||
39 | { | ||
40 | // m_assetManager = assetManager; | ||
41 | m_assetProvider = assetProvider; | ||
42 | } | ||
43 | } | ||
44 | } \ No newline at end of file | ||