mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Refactoring XmlRpc serialization to use XmlWriterSettings
--HG-- branch : 1.x
This commit is contained in:
@@ -3,6 +3,7 @@ using System.IO;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Orchard.Core.XmlRpc.Models;
|
using Orchard.Core.XmlRpc.Models;
|
||||||
using Orchard.Core.XmlRpc.Services;
|
using Orchard.Core.XmlRpc.Services;
|
||||||
@@ -38,18 +39,15 @@ namespace Orchard.Core.XmlRpc.Controllers {
|
|||||||
if (methodResponse == null)
|
if (methodResponse == null)
|
||||||
throw new HttpException(500, "TODO: xmlrpc fault");
|
throw new HttpException(500, "TODO: xmlrpc fault");
|
||||||
|
|
||||||
var result = _writer.MapMethodResponse(methodResponse);
|
|
||||||
return Content(result.ToString(), "text/xml");
|
var sb = new StringBuilder();
|
||||||
}
|
var settings = new XmlWriterSettings {Encoding = Encoding.UTF8};
|
||||||
|
|
||||||
[HttpHead, ActionName("Index")]
|
using (XmlWriter w = XmlWriter.Create(sb, settings)) {
|
||||||
[AlwaysAccessible]
|
var result = _writer.MapMethodResponse(methodResponse);
|
||||||
public ActionResult ExistenceDiscovery() {
|
result.Save(w);
|
||||||
//see http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/03/11/office-existence-discovery-protocol.aspx
|
return Content(result.ToString(), "text/xml");
|
||||||
Logger.Debug("Microsoft Office Existence Discovery");
|
}
|
||||||
|
|
||||||
Response.AddHeader("Last-Modified", _clock.UtcNow.ToString("o"));
|
|
||||||
return Content("", "text/xml");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private XRpcMethodResponse Dispatch(XRpcMethodCall request) {
|
private XRpcMethodResponse Dispatch(XRpcMethodCall request) {
|
||||||
@@ -68,4 +66,5 @@ namespace Orchard.Core.XmlRpc.Controllers {
|
|||||||
return context.Response;
|
return context.Response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user