Exemplo n.º 1
0
        protected override DoNext performInvoke()
        {
            var mimeTypes = _request.Get <CurrentMimeType>();

            var writer = SelectWriter(mimeTypes);

            if (writer == null && InsideBehavior != null)
            {
                // TODO -- want this to be smarter later
                if (mimeTypes.AcceptsHtml() || mimeTypes.AcceptsAny())
                {
                    return(DoNext.Continue);
                }
            }

            if (writer == null)
            {
                _writer.WriteResponseCode(HttpStatusCode.NotAcceptable);
            }
            else
            {
                writer.Write(_source.FindValues(), _writer);
            }

            return(DoNext.Stop);
        }
Exemplo n.º 2
0
        protected override DoNext performInvoke()
        {
            var mimeTypes = _request.Get <CurrentMimeType>();

            if (mimeTypes.AcceptTypes.Contains(MediaTypeNames.Text.Html))
            {
                return(DoNext.Continue);
            }

            var writer = SelectWriter(mimeTypes);

            if (writer == null)
            {
                _writer.WriteResponseCode(HttpStatusCode.NotAcceptable);
            }
            else
            {
                writer.Write(_source.FindValues(), _writer);
            }

            return(DoNext.Stop);
        }