Ejemplo n.º 1
0
        private void HttpListGetAction(IDEContext r, string id, int start = 0, int count = Int32.MaxValue)
        {
            // Suche den passenden Controller
            var controller = FindController(id);

            if (controller == null)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest, String.Format("Liste '{0}' nicht gefunden.", id));
            }

            // check security token
            r.DemandToken(controller.SecurityToken);

            // write list
            ((IDEListService)Server).WriteList(r, controller, start, count);
        }         // func HttpListGetAction
Ejemplo n.º 2
0
        }         // proc CollectActions

        /// <summary>Führt eine Aktion aus.</summary>
        /// <param name="actionName">Name der Aktion</param>
        /// <param name="context">Parameter, die übergeben werden sollen.</param>
        /// <returns>Rückgabe</returns>
        public object InvokeAction(string actionName, IDEContext context)
        {
            // Suche die Action im Cache
            DEConfigAction a;

            lock (actions)
            {
                a = actions[actionName];
                if (a == null)                 // Beziehungsweise erzeuge sie
                {
                    a = CompileAction(actionName);
                    if (a == null)
                    {
                        a = DEConfigAction.Empty;
                    }
                    actions[actionName] = a;
                }
            }

            // Führe die Aktion aus
            try
            {
                if (a == DEConfigAction.Empty)
                {
                    throw new HttpResponseException(HttpStatusCode.BadRequest, String.Format("Action {0} not found", actionName));
                }

                context.DemandToken(a.SecurityToken);
                return(a.Invoke(this, context));
            }
            catch (Exception e)
            {
                if (!a.IsSafeCall || context.IsOutputStarted || (e is HttpResponseException))                 // Antwort kann nicht mehr gesendet werden
                {
                    throw;
                }

                // Meldung protokollieren
                Log.LogMsg(LogMsgType.Error, e.GetMessageString());
                return(CreateDefaultXmlReturn(false, e.Message));
            }
        }         // func InvokeAction