Ejemplo n.º 1
0
    protected override HttpStatusCode ProcessRequestInternal(HttpContext context, VivendiResource resource)
    {
        // return the resource
        switch (resource)
        {
        case VivendiCollection collection: WriteCollection(context, collection); break;

        case VivendiDocument document: WriteDocument(context, document); break;

        default: return(HttpStatusCode.NotImplemented);
        }
        return(HttpStatusCode.OK);
    }
Ejemplo n.º 2
0
    public static Uri GetHref(this HttpContext context, VivendiResource resource)
    {
        // get the suffix and prefix
        var suffix = resource.Path;
        var prefix = context.Request.ApplicationPath;
        var path   = new StringBuilder();

        // append the paths if they are not roots
        if (prefix.Length > 1)
        {
            path.Append(prefix);
        }
        if (suffix.Length > 1)
        {
            path.Append(suffix);
        }

        // terminate collections with a trailing slash and return the URI
        if (resource is VivendiCollection)
        {
            path.Append("/");
        }
        return(new Uri(context.Request.Url, path.ToString()));
    }
Ejemplo n.º 3
0
 public static Uri GetRelativeHref(this HttpContext context, VivendiResource resource) => context.Request.Url.MakeRelativeUri(context.GetHref(resource));
Ejemplo n.º 4
0
 protected override HttpStatusCode ProcessRequestInternal(HttpContext context, VivendiResource resource) => HttpStatusCode.OK;
Ejemplo n.º 5
0
 public override void Get(VivendiResource resource, XmlElement value) => _getter(resource as T ?? throw new ArgumentOutOfRangeException("resource"), value);
Ejemplo n.º 6
0
 public abstract void Set(VivendiResource resource, XmlElement value);
Ejemplo n.º 7
0
 public abstract bool IsApplicable(VivendiResource resource);
Ejemplo n.º 8
0
 protected abstract HttpStatusCode ProcessRequestInternal(HttpContext context, VivendiResource resource);