123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using Nini.Config;
- using log4net;
- using System;
- using System.Collections.Generic;
- using System.Reflection;
- using System.IO;
- using System.Net;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Xml;
- using System.Xml.Serialization;
- using OpenSim.Server.Base;
- using OpenSim.Services.Interfaces;
- using OpenSim.Framework;
- using OpenSim.Framework.Servers.HttpServer;
- using OpenMetaverse;
- namespace OpenSim.Server.Handlers.Inventory
- {
- public class InventoryServerMoveItemsHandler : BaseStreamHandler
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private IInventoryService m_InventoryService;
- public InventoryServerMoveItemsHandler(IInventoryService service) :
- base("PUT", "/inventory")
- {
- m_InventoryService = service;
- }
- protected override byte[] ProcessRequest(string path, Stream request,
- IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
- {
- XmlSerializer xs = new XmlSerializer(typeof (List<InventoryItemBase>));
- List<InventoryItemBase> items = (List<InventoryItemBase>)xs.Deserialize(request);
- bool result = false;
- string[] p = SplitParams(path);
- if (p.Length > 0)
- {
- UUID ownerID = UUID.Zero;
- UUID.TryParse(p[0], out ownerID);
- result = m_InventoryService.MoveItems(ownerID, items);
- }
- else
- m_log.WarnFormat("[MOVEITEMS HANDLER]: ownerID not provided in request. Unable to serve.");
- xs = new XmlSerializer(typeof(bool));
- return ServerUtils.SerializeResult(xs, result);
- }
- }
- }
|