You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
562 B
21 lines
562 B
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using MediaBrowser.Common.Net.Handlers;
|
|
using MediaBrowser.Common.Serialization;
|
|
|
|
namespace MediaBrowser.Api.HttpHandlers
|
|
{
|
|
public abstract class JsonHandler : BaseJsonHandler
|
|
{
|
|
protected abstract object ObjectToSerialize { get; }
|
|
|
|
protected override Task WriteResponseToOutputStream(Stream stream)
|
|
{
|
|
return Task.Run(() =>
|
|
{
|
|
JsonSerializer.SerializeToStream(ObjectToSerialize, stream);
|
|
});
|
|
}
|
|
}
|
|
}
|