public static ARemoteContentHandler Resolve(CompositeContext compositeRequest)
        {
            ARemoteContentHandler handler;

            switch (compositeRequest.RequestType)
            {
            case CompositeRequestType.Asset:
                handler = new ContentHandler(compositeRequest);
                break;

            case CompositeRequestType.Rest:
                handler = new RestHandler(compositeRequest);
                break;

            case CompositeRequestType.Html:
                handler = new HtmlHandler(compositeRequest);
                break;

            case CompositeRequestType.NotSupported:
            default:
                throw new InvalidOperationException("request cannot be handled");
            }

            return(handler);
        }
Ejemplo n.º 2
0
        public async Task Invoke(HttpContext httpContext)
        {
            var compositeRequest = new CompositeContext(httpContext, _pages);

            if (compositeRequest.RequestType.Equals(CompositeRequestType.NotSupported))
            {
                return;
            }

            var handler = CompositeContentResolver.Resolve(compositeRequest);

            await handler.Handle(_next);
        }
 public RestHandler(CompositeContext compositeRequest) : base(compositeRequest)
 {
 }
 protected ARemoteContentHandler(CompositeContext compositeRequest)
 {
     CompositeContext = compositeRequest;
     RemoteFetcher    = new RemoteFetcher(compositeRequest.RemotePath);
 }
 public HtmlHandler(CompositeContext compositeContext) : base(compositeContext)
 {
 }