示例#1
0
    private async Task RouteRequestInternalAsync(IPublishedRequestBuilder builder, bool skipContentFinders = false)
    {
        // if request builder was already flagged to redirect then return
        // whoever called us is in charge of actually redirecting
        if (builder.IsRedirect())
        {
            return;
        }

        // set the culture
        SetVariationContext(builder.Culture);

        var foundContentByFinders = false;

        // Find the published content if it's not assigned.
        // This could be manually assigned with a custom route handler, etc...
        // which in turn could call this method
        // to setup the rest of the pipeline but we don't want to run the finders since there's one assigned.
        if (!builder.HasPublishedContent() && !skipContentFinders)
        {
            if (_logger.IsEnabled(LogLevel.Debug))
            {
                _logger.LogDebug("FindPublishedContentAndTemplate: Path={UriAbsolutePath}", builder.Uri.AbsolutePath);
            }

            // run the document finders
            foundContentByFinders = await FindPublishedContent(builder);
        }

        // if we are not a redirect
        if (!builder.IsRedirect())
        {
            // handle not-found, redirects, access...
            await HandlePublishedContent(builder);

            // find a template
            FindTemplate(builder, foundContentByFinders);

            // handle umbracoRedirect
            FollowExternalRedirect(builder);

            // handle wildcard domains
            HandleWildcardDomains(builder);

            // set the culture  -- again, 'cos it might have changed due to a finder or wildcard domain
            SetVariationContext(builder.Culture);
        }

        // trigger the routing request (used to be called Prepared) event - at that point it is still possible to change about anything
        // even though the request might be flagged for redirection - we'll redirect _after_ the event
        var routingRequest = new RoutingRequestNotification(builder);
        await _eventAggregator.PublishAsync(routingRequest);

        // we don't take care of anything so if the content has changed, it's up to the user
        // to find out the appropriate template
    }
示例#2
0
    private async Task <IPublishedRequest> TryRouteRequest(IPublishedRequestBuilder request)
    {
        FindDomain(request);

        if (request.IsRedirect())
        {
            return(request.Build());
        }

        if (request.HasPublishedContent())
        {
            return(request.Build());
        }

        await FindPublishedContent(request);

        return(request.Build());
    }
示例#3
0
        private IPublishedRequest TryRouteRequest(IPublishedRequestBuilder request)
        {
            FindDomain(request);

            if (request.IsRedirect())
            {
                return(request.Build());
            }

            if (request.HasPublishedContent())
            {
                return(request.Build());
            }

            FindPublishedContent(request);

            return(request.Build());
        }