Beispiel #1
0
        private void CreateResponseBlocks()
        {
            CreateWriteStatusBlock();
            _blocks.AddRange(PropertyCookieSetter.GetPropertyCookieSetters(_type, _handler, _context));

            var redirectBehaviorInfo = new ResponseBehaviorInfo(typeof(object), typeof(Redirect2), Priority.High);

            AddBehaviorBlock(redirectBehaviorInfo);

            foreach (var behaviorInfo in ResponseBehaviorInfo.GetInPriorityOrder())
            {
                AddBehaviorBlock(behaviorInfo);
            }

            // Don't write response for HEAD requests
            if ("HEAD".Equals(_httpMethod, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            foreach (var behaviorInfo in OutputBehaviorInfo.GetInPriorityOrder())
            {
                // Only one Output block is going to be relevant
                if (AddBehaviorBlock(behaviorInfo))
                {
                    return;
                }
            }

            // If we didn't trigger an Output, try writing a View.
            _blocks.Add(Expression.Call(_methodLookup.WriteView, _handler, _context));
        }
Beispiel #2
0
 private IEnumerable <BehaviorInfo> GetOutputBehaviorInfos()
 {
     return(OutputBehaviorInfo.GetInPriorityOrder().Where(HandlerHasBehavior));
 }