aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Clients/RegionClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Clients/RegionClient.cs')
-rw-r--r--OpenSim/Framework/Communications/Clients/RegionClient.cs76
1 files changed, 76 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs
index d98852b..196bcf9 100644
--- a/OpenSim/Framework/Communications/Clients/RegionClient.cs
+++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs
@@ -417,6 +417,82 @@ namespace OpenSim.Framework.Communications.Clients
417 417
418 } 418 }
419 419
420 public bool DoCreateObjectCall(RegionInfo region, UUID userID, UUID itemID)
421 {
422 ulong regionHandle = GetRegionHandle(region.RegionHandle);
423 string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/";
424 //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri);
425
426 WebRequest ObjectCreateRequest = WebRequest.Create(uri);
427 ObjectCreateRequest.Method = "PUT";
428 ObjectCreateRequest.ContentType = "application/json";
429 ObjectCreateRequest.Timeout = 10000;
430
431 OSDMap args = new OSDMap(2);
432 args["userid"] = OSD.FromUUID(userID);
433 args["itemid"] = OSD.FromUUID(itemID);
434
435 string strBuffer = "";
436 byte[] buffer = new byte[1];
437 try
438 {
439 strBuffer = OSDParser.SerializeJsonString(args);
440 UTF8Encoding str = new UTF8Encoding();
441 buffer = str.GetBytes(strBuffer);
442
443 }
444 catch (Exception e)
445 {
446 m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message);
447 // ignore. buffer will be empty, caller should check.
448 }
449
450 Stream os = null;
451 try
452 { // send the Post
453 ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
454 os = ObjectCreateRequest.GetRequestStream();
455 os.Write(buffer, 0, strBuffer.Length); //Send it
456 os.Close();
457 //m_log.InfoFormat("[REST COMMS]: Posted CreateObject request to remote sim {0}", uri);
458 }
459 //catch (WebException ex)
460 catch
461 {
462 // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message);
463
464 return false;
465 }
466
467 // Let's wait for the response
468 //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall");
469
470 try
471 {
472 WebResponse webResponse = ObjectCreateRequest.GetResponse();
473 if (webResponse == null)
474 {
475 m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post");
476 }
477
478 StreamReader sr = new StreamReader(webResponse.GetResponseStream());
479 sr.ReadToEnd().Trim();
480 sr.ReadToEnd().Trim();
481 sr.Close();
482
483 //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply);
484
485 }
486 catch (WebException ex)
487 {
488 m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message);
489 // ignore, really
490 }
491
492 return true;
493
494 }
495
420 public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) 496 public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion)
421 { 497 {
422 string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; 498 string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/";