From 6ef9d4da901a346c232458317cca6268da888e2e Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 18 Aug 2008 00:39:10 +0000 Subject: Formatting cleanup. --- .../Rest/Inventory/RestAssetServices.cs | 36 ++++++++-------------- 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs') diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index b4eb7db..95b0ee3 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs @@ -23,7 +23,6 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ using libsecondlife; @@ -40,10 +39,8 @@ using OpenSim.Framework.Communications.Cache; namespace OpenSim.ApplicationPlugins.Rest.Inventory { - public class RestAssetServices : IRest { - private bool enabled = false; private string qPrefix = "assets"; @@ -52,7 +49,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory public RestAssetServices() { - Rest.Log.InfoFormat("{0} Asset services initializing", MsgId); Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); @@ -73,7 +69,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory enabled = true; Rest.Log.InfoFormat("{0} Asset services initialization complete", MsgId); - } // Post-construction, pre-enabled initialization opportunity @@ -84,7 +79,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory } // Called by the plug-in to halt REST processing. Local processing is - // disabled, and control blocks until all current processing has + // disabled, and control blocks until all current processing has // completed. No new processing will be started public void Close() @@ -111,14 +106,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory private void DoAsset(RequestData rparm) { - - if (!enabled) return; + if (!enabled) + return; AssetRequestData rdata = (AssetRequestData) rparm; Rest.Log.DebugFormat("{0} REST Asset handler ENTRY", MsgId); - // Now that we know this is a serious attempt to + // Now that we know this is a serious attempt to // access inventory data, we should find out who // is asking, and make sure they are authorized // to do so. We need to validate the caller's @@ -129,9 +124,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // With the present HTTP server we can't use the // builtin authentication mechanisms because they // would be enforced for all in-bound requests. - // Instead we look at the headers ourselves and + // Instead we look at the headers ourselves and // handle authentication directly. - + try { if (!rdata.IsAuthenticated) @@ -144,13 +139,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory if (e.statusCode == Rest.HttpStatusCodeNotAuthorized) { Rest.Log.WarnFormat("{0} User not authenticated", MsgId); - Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, + Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); } else { Rest.Log.ErrorFormat("{0} User authentication failed", MsgId); - Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, + Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); } throw (e); @@ -173,7 +168,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory case "post" : case "delete" : default : - Rest.Log.WarnFormat("{0} Asset: Method not supported: {1}", + Rest.Log.WarnFormat("{0} Asset: Method not supported: {1}", MsgId, rdata.method); rdata.Fail(Rest.HttpStatusCodeBadRequest, Rest.HttpStatusDescBadRequest); @@ -194,7 +189,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory private void DoGet(AssetRequestData rdata) { - bool istexture = false; Rest.Log.DebugFormat("{0} REST Asset handler, Method = <{1}> ENTRY", MsgId, rdata.method); @@ -204,13 +198,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory if (rdata.parameters.Length == 1) { - LLUUID uuid = new LLUUID(rdata.parameters[0]); AssetBase asset = Rest.AssetServices.GetAsset(uuid, istexture); if (asset != null) { - Rest.Log.DebugFormat("{0} Asset located <{1}>", MsgId, rdata.parameters[0]); rdata.initXmlWriter(); @@ -227,19 +219,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length); rdata.writer.WriteFullEndElement(); - } else { Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, rdata.path); - rdata.Fail(Rest.HttpStatusCodeNotFound, + rdata.Fail(Rest.HttpStatusCodeNotFound, Rest.HttpStatusDescNotFound); } } rdata.Complete(); rdata.Respond("Asset " + rdata.method + ": Normal completion"); - } private void DoPut(AssetRequestData rdata) @@ -257,7 +247,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory if (!xml.ReadToFollowing("Asset")) { Rest.Log.DebugFormat("{0} Invalid request data: <{1}>", MsgId, rdata.path); - rdata.Fail(Rest.HttpStatusCodeBadRequest, + rdata.Fail(Rest.HttpStatusCodeBadRequest, Rest.HttpStatusDescBadRequest); } @@ -275,13 +265,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory else { Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, rdata.path); - rdata.Fail(Rest.HttpStatusCodeNotFound, + rdata.Fail(Rest.HttpStatusCodeNotFound, Rest.HttpStatusDescNotFound); } rdata.Complete(); rdata.Respond("Asset " + rdata.method + ": Normal completion"); - } internal class AssetRequestData : RequestData @@ -291,6 +280,5 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory { } } - } } -- cgit v1.1