Exemple #1
0
        protected override bool Process(IInteraction parameters)
        {
            HttpInteraction interaction = (HttpInteraction)parameters.GetClosest(typeof(HttpInteraction));

            string mimeType;

            if (MimeType.Length > 0)
            {
                if (this.CharSet.Length > 0)
                {
                    mimeType = string.Format(
                        "{0}; charset={1}",
                        this.MimeType,
                        this.CharSet);
                }
                else
                {
                    mimeType = this.MimeType;
                }
                interaction.SetContentType(mimeType);
            }

            interaction.SetStatusCode(this.Statuscode);

            return(WithBranch.TryProcess(parameters));
        }
Exemple #2
0
        protected override bool Process(IInteraction parameters)
        {
            bool success = true;

            HttpInteraction interaction = (HttpInteraction)parameters.GetClosest(typeof(HttpInteraction));

            string method = interaction.RequestMethod;

            if (IsMethodValid(method))
            {
                success &= Branches [method.ToLower()].TryProcess(parameters);
            }
            else
            {
                interaction.SetStatusCode(405);
            }

            return(success);
        }