aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-12-05 19:02:57 +0000
committerMW2007-12-05 19:02:57 +0000
commitd2736437d42758ddefee4e50e23c465e514077be (patch)
tree35d9ece58c1c9d63d28015a60964a5103eb1a343
parentFrom Justin Casey (IBM) (diff)
downloadopensim-SC-d2736437d42758ddefee4e50e23c465e514077be.zip
opensim-SC-d2736437d42758ddefee4e50e23c465e514077be.tar.gz
opensim-SC-d2736437d42758ddefee4e50e23c465e514077be.tar.bz2
opensim-SC-d2736437d42758ddefee4e50e23c465e514077be.tar.xz
Some refactoring of the RestObjectPoster (and related classes).
-rw-r--r--OpenSim/Framework/Servers/RestObjectPoster.cs7
-rw-r--r--OpenSim/Framework/Servers/RestObjectPosterResponse.cs7
-rw-r--r--OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs4
-rw-r--r--OpenSim/Grid/UserServer/Main.cs2
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs4
5 files changed, 17 insertions, 7 deletions
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
11 { 11 {
12 public static void BeginPostObject<TRequest>(string requestUrl, TRequest obj) 12 public static void BeginPostObject<TRequest>(string requestUrl, TRequest obj)
13 { 13 {
14 BeginPostObject("POST", requestUrl, obj);
15 }
16
17 public static void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj)
18 {
14 Type type = typeof(TRequest); 19 Type type = typeof(TRequest);
15 20
16 WebRequest request = WebRequest.Create(requestUrl); 21 WebRequest request = WebRequest.Create(requestUrl);
17 request.Method = "POST"; 22 request.Method = verb;
18 request.ContentType = "text/xml"; 23 request.ContentType = "text/xml";
19 24
20 MemoryStream buffer = new MemoryStream(); 25 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
15 15
16 public void BeginPostObject<TRequest>(string requestUrl, TRequest obj) 16 public void BeginPostObject<TRequest>(string requestUrl, TRequest obj)
17 { 17 {
18 BeginPostObject("POST", requestUrl, obj);
19 }
20
21 public void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj)
22 {
18 Type type = typeof(TRequest); 23 Type type = typeof(TRequest);
19 24
20 WebRequest request = WebRequest.Create(requestUrl); 25 WebRequest request = WebRequest.Create(requestUrl);
21 request.Method = "POST"; 26 request.Method = verb;
22 request.ContentType = "text/xml"; 27 request.ContentType = "text/xml";
23 28
24 MemoryStream buffer = new MemoryStream(); 29 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
9{ 9{
10 public class SynchronousRestObjectPoster 10 public class SynchronousRestObjectPoster
11 { 11 {
12 public static TResponse BeginPostObject<TRequest, TResponse>(string requestUrl, TRequest obj) 12 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
13 { 13 {
14 Type type = typeof(TRequest); 14 Type type = typeof(TRequest);
15 15
16 WebRequest request = WebRequest.Create(requestUrl); 16 WebRequest request = WebRequest.Create(requestUrl);
17 request.Method = "POST"; 17 request.Method = verb;
18 request.ContentType = "text/xml"; 18 request.ContentType = "text/xml";
19 19
20 MemoryStream buffer = new MemoryStream(); 20 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
157 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); 157 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
158 // requester.ReturnResponseVal = TestResponse; 158 // requester.ReturnResponseVal = TestResponse;
159 // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); 159 // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
160 List<InventoryFolderBase> folders = SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); 160 List<InventoryFolderBase> folders = SynchronousRestObjectPoster.BeginPostObject< LLUUID, List<InventoryFolderBase>>("POST",m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
161 break; 161 break;
162 } 162 }
163 } 163 }
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
197 197
198 protected override InventoryData CreateInventoryData(LLUUID userID) 198 protected override InventoryData CreateInventoryData(LLUUID userID)
199 { 199 {
200 List<InventoryFolderBase> folders = SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>(m_config.InventoryUrl + "RootFolders/", userID); 200 List<InventoryFolderBase> folders = SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST", m_config.InventoryUrl + "RootFolders/", userID);
201 if (folders ==null | folders.Count == 0) 201 if (folders ==null | folders.Count == 0)
202 { 202 {
203 RestObjectPoster.BeginPostObject<LLUUID>(m_config.InventoryUrl + "CreateInventory/", userID); 203 RestObjectPoster.BeginPostObject<LLUUID>(m_config.InventoryUrl + "CreateInventory/", userID);
204 Thread.Sleep(1000); 204 Thread.Sleep(1000);
205 folders = SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>(m_config.InventoryUrl + "RootFolders/", userID); 205 folders = SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST", m_config.InventoryUrl + "RootFolders/", userID);
206 } 206 }
207 207
208 if(folders.Count >0) 208 if(folders.Count >0)