From d2736437d42758ddefee4e50e23c465e514077be Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 5 Dec 2007 19:02:57 +0000 Subject: Some refactoring of the RestObjectPoster (and related classes). --- OpenSim/Framework/Servers/RestObjectPoster.cs | 7 ++++++- OpenSim/Framework/Servers/RestObjectPosterResponse.cs | 7 ++++++- OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs | 4 ++-- OpenSim/Grid/UserServer/Main.cs | 2 +- OpenSim/Grid/UserServer/UserLoginService.cs | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/RestObjectPoster.cs b/OpenSim/Framework/Servers/RestObjectPoster.cs index 9bcfcca..991b1d5 100644 --- a/OpenSim/Framework/Servers/RestObjectPoster.cs +++ b/OpenSim/Framework/Servers/RestObjectPoster.cs @@ -11,10 +11,15 @@ namespace OpenSim.Framework.Servers { public static void BeginPostObject(string requestUrl, TRequest obj) { + BeginPostObject("POST", requestUrl, obj); + } + + public static void BeginPostObject(string verb, string requestUrl, TRequest obj) + { Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); - request.Method = "POST"; + request.Method = verb; request.ContentType = "text/xml"; MemoryStream buffer = new MemoryStream(); diff --git a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs index eeae285..d91d566 100644 --- a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs +++ b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs @@ -15,10 +15,15 @@ namespace OpenSim.Framework.Servers public void BeginPostObject(string requestUrl, TRequest obj) { + BeginPostObject("POST", requestUrl, obj); + } + + public void BeginPostObject(string verb, string requestUrl, TRequest obj) + { Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); - request.Method = "POST"; + request.Method = verb; request.ContentType = "text/xml"; MemoryStream buffer = new MemoryStream(); diff --git a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs index dde4c02..11a74b1 100644 --- a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs +++ b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs @@ -9,12 +9,12 @@ namespace OpenSim.Framework.Servers { public class SynchronousRestObjectPoster { - public static TResponse BeginPostObject(string requestUrl, TRequest obj) + public static TResponse BeginPostObject(string verb, string requestUrl, TRequest obj) { Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); - request.Method = "POST"; + request.Method = verb; request.ContentType = "text/xml"; MemoryStream buffer = new MemoryStream(); diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 634698e..d2ad6ae 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -157,7 +157,7 @@ namespace OpenSim.Grid.UserServer // RestObjectPosterResponse> requester = new RestObjectPosterResponse>(); // requester.ReturnResponseVal = TestResponse; // requester.BeginPostObject(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); - List folders = SynchronousRestObjectPoster.BeginPostObject>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); + List folders = SynchronousRestObjectPoster.BeginPostObject< LLUUID, List>("POST",m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); break; } } diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 4d1328e..ccd3548 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -197,12 +197,12 @@ namespace OpenSim.Grid.UserServer protected override InventoryData CreateInventoryData(LLUUID userID) { - List folders = SynchronousRestObjectPoster.BeginPostObject>(m_config.InventoryUrl + "RootFolders/", userID); + List folders = SynchronousRestObjectPoster.BeginPostObject>("POST", m_config.InventoryUrl + "RootFolders/", userID); if (folders ==null | folders.Count == 0) { RestObjectPoster.BeginPostObject(m_config.InventoryUrl + "CreateInventory/", userID); Thread.Sleep(1000); - folders = SynchronousRestObjectPoster.BeginPostObject>(m_config.InventoryUrl + "RootFolders/", userID); + folders = SynchronousRestObjectPoster.BeginPostObject>("POST", m_config.InventoryUrl + "RootFolders/", userID); } if(folders.Count >0) -- cgit v1.1