From 27c8cc5b1fc78bad6a8286f4236e4ac094b32e52 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Tue, 21 Apr 2009 19:42:36 +0000 Subject: Thank you kindly, TLaukkan for a patch that: Added support for loading bare asset binaries (as opposed to xml encoded asset base) to both sandbox asset service and cable beach. * Added support for enabling region asset service when mxp is enabled. * Moved base http server content type defaulting before invocation of request handle method to allow for variable content type in the response. --- .../Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs | 31 ++++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs index ee35ae2..bacfe57 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetFrontendPlugin.cs @@ -113,17 +113,26 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim AssetBase asset = new AssetBase(); if ((dataResponse = m_server.StorageProvider.TryFetchDataMetadata(assetID, out asset)) == BackendResponse.Success) { - XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); - MemoryStream ms = new MemoryStream(); - XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); - xs.Serialize(xw, asset); - xw.Flush(); - - ms.Seek(0, SeekOrigin.Begin); - buffer = ms.GetBuffer(); - Array.Resize(ref buffer, (int) ms.Length); - ms.Close(); - httpResponse.StatusCode = (int) HttpStatusCode.OK; + if (rawUrl.Length >= 4 && rawUrl[3] == "data") + { + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.ContentType = Utils.SLAssetTypeToContentType(asset.Type); + buffer=asset.Data; + } + else + { + XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); + MemoryStream ms = new MemoryStream(); + XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); + xs.Serialize(xw, asset); + xw.Flush(); + + ms.Seek(0, SeekOrigin.Begin); + buffer = ms.GetBuffer(); + Array.Resize(ref buffer, (int)ms.Length); + ms.Close(); + httpResponse.StatusCode = (int)HttpStatusCode.OK; + } } else { -- cgit v1.1