57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
// /**
|
|
// * File: ObjectHandler.cs
|
|
// * Author: haraldwolff
|
|
// *
|
|
// * This file and it's content is copyrighted by the Author and / or copyright holder.
|
|
// * Any use wihtout proper permission is illegal and may lead to legal actions.
|
|
// *
|
|
// *
|
|
// **/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using ln.http;
|
|
using ln.types.reflection;
|
|
using ln.json.mapping;
|
|
|
|
namespace ln.json.http
|
|
{
|
|
public class ObjectHandler
|
|
{
|
|
public ObjectHandler()
|
|
{
|
|
}
|
|
|
|
public HttpResponse DoObject(HttpRequest httpRequest, object o, Queue<string> pathQueue)
|
|
{
|
|
if (pathQueue.Count > 1)
|
|
{
|
|
string next = pathQueue.Dequeue();
|
|
TypeDescriptor typeDescriptor = TypeDescriptor.GetDescriptor(o.GetType());
|
|
|
|
if (typeDescriptor.ContainsAttribute(next))
|
|
{
|
|
|
|
}
|
|
}
|
|
else if (pathQueue.Count == 0)
|
|
{
|
|
switch (httpRequest.Method)
|
|
{
|
|
case "GET":
|
|
return httpRequest.SendJSON(JSONMapper.DefaultMapper.ToJson(o));
|
|
case "PUT":
|
|
|
|
break;
|
|
default:
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|