예제 #1
0
        public override void Execute(HttpContextBase context, string query, Parameters parameters)
        {
            var item = parameters.Database.Items.GetItem(query, parameters.Language);

            if (item != null)
            {
                var items = new List<Item>
                {
                    item
                };

                foreach (var language in item.Languages.Where(x => !x.Equals(parameters.Language)))
                {
                    var languageItem = item.Database.Items.GetItem(item.ID, language);

                    items.Add(languageItem);
                }

                _serializer.SerializeVersions(items, context.Response.OutputStream, parameters.ItemFields.ToArray(), parameters.Cdn);

                context.Response.ContentType = "application/json";
            }
            else
            {
                // TODO: Should we use response codes or should we set it on json response object?
                context.Response.StatusCode = 404;
            }
        }
예제 #2
0
        internal void DoExecute(HttpContextBase context, string decodedPath)
        {
            var parameters = new Parameters(context.Request, _databases);

            if (!parameters.IsValid())
            {
                context.Response.StatusCode = 400;

                return;
            }

            var relativePath = decodedPath.Replace(HandlesPath, "/");
            var isGuidMatch = _guidRegex.Match(relativePath);
            var query = isGuidMatch.Success ? string.Concat("{", isGuidMatch.Value, "}") : string.Concat("/", relativePath);

            Execute(context, query, parameters);
        }
예제 #3
0
        public override void Execute(HttpContextBase context, string query, Parameters parameters)
        {
            var item = parameters.Database.Items.GetItem(query, parameters.Language);

            if (item != null)
            {
                _serializer.SerializeItem(item, context.Response.OutputStream,
                    parameters.DeviceName,
                    parameters.ItemFields.ToArray(),
                    parameters.ChildFields.ToArray(),
                    parameters.Cdn);

                context.Response.ContentType = "application/json";
            }
            else
            {
                // TODO: Should we use response codes or should we set it on json response object?
                context.Response.StatusCode = 404;
            }
        }
예제 #4
0
 public abstract void Execute(HttpContextBase context, string query, Parameters parameters);
예제 #5
0
 public override void Execute(HttpContextBase context, string query, Parameters parameters)
 {
     context.Response.Write("Help...");
 }
예제 #6
0
 public abstract void Execute(HttpContextBase context, string query, Parameters parameters);