123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using Nini.Config;
- using log4net;
- using System;
- 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.ServiceAuth;
- using OpenSim.Framework.Servers.HttpServer;
- using OpenMetaverse;
- namespace OpenSim.Server.Handlers.Asset
- {
- public class AssetsExistHandler : BaseStreamHandler
- {
-
- private IAssetService m_AssetService;
- public AssetsExistHandler(IAssetService service) :
- base("POST", "/get_assets_exist")
- {
- m_AssetService = service;
- }
- public AssetsExistHandler(IAssetService service, IServiceAuth auth) :
- base("POST", "/get_assets_exist", auth)
- {
- m_AssetService = service;
- }
- protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
- {
- XmlSerializer xs;
- string[] ids;
- try
- {
- xs = new XmlSerializer(typeof(string[]));
- ids = (string[])xs.Deserialize(request);
- }
- catch (Exception)
- {
- httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
- return null;
- }
- bool[] exist = m_AssetService.AssetsExist(ids);
- xs = new XmlSerializer(typeof(bool[]));
- return ServerUtils.SerializeResult(xs, exist);
- }
- }
- }
|