コード例 #1
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var serviceName = ctx.GetServiceName();
            var instanceId  = ctx.GetInstanceID();
            var bookmark    = ctx.GetBookmark();
            var workspaceId = ctx.GetWorkspaceID();
            var requestTo   = new WebRequestTO();
            var xml         = new SubmittedData().GetPostData(ctx);

            if (!string.IsNullOrEmpty(xml))
            {
                requestTo.RawRequestPayload = xml;
            }

            requestTo.ServiceName   = serviceName;
            requestTo.InstanceID    = instanceId;
            requestTo.Bookmark      = bookmark;
            requestTo.WebServerUrl  = ctx.Request.Uri.ToString();
            requestTo.Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}";

            var variables = ctx.Request.BoundVariables;

            if (variables != null)
            {
                foreach (string key in variables)
                {
                    requestTo.Variables.Add(key, variables[key]);
                }
            }
            Thread.CurrentPrincipal = ctx.Request.User;
            var responseWriter = CreateForm(requestTo, serviceName, workspaceId, ctx.FetchHeaders(), ctx.Request.User);

            ctx.Send(responseWriter);
        }
コード例 #2
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            LoadSecuritySettings();

            var serviceName = ctx.GetServiceName();
            var instanceId  = ctx.GetInstanceID();
            var bookmark    = ctx.GetBookmark();
            var workspaceId = ctx.GetWorkspaceID();

            var requestTo = new WebRequestTO
            {
                ServiceName   = serviceName,
                InstanceID    = instanceId,
                Bookmark      = bookmark,
                WebServerUrl  = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}/public/{OverrideResource.Name}",
                Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}"
            };

            var data = SubmittedData.GetPostData(ctx);

            if (!string.IsNullOrEmpty(data))
            {
                requestTo.RawRequestPayload = data;
            }

            var variables = ctx.Request.BoundVariables;

            if (variables != null)
            {
                foreach (string key in variables)
                {
                    requestTo.Variables.Add(key, variables[key]);
                }
            }

            Thread.CurrentPrincipal = ctx.Request.User;
            try
            {
                var response = ExecuteWorkflow(requestTo, $"{OverrideResource.Name}.json", workspaceId,
                                               ctx.FetchHeaders(), ctx.Request.User);
                ctx.Send(response);
            }
            catch (Exception e)
            {
                Dev2Logger.Warn($"failed processing login request: {e.Message}", GlobalConstants.WarewolfWarn);
                throw;
            }
        }
コード例 #3
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var serviceName = ctx.GetServiceName();
            var instanceId  = ctx.GetInstanceID();
            var bookmark    = ctx.GetBookmark();

            ctx.GetDataListID();
            var workspaceId = ctx.GetWorkspaceID();
            var formData    = new WebRequestTO();

            var xml = new SubmittedData().GetPostData(ctx);

            if (!string.IsNullOrEmpty(xml))
            {
                formData.RawRequestPayload = xml;
            }

            formData.ServiceName   = serviceName;
            formData.InstanceID    = instanceId;
            formData.Bookmark      = bookmark;
            formData.WebServerUrl  = ctx.Request.Uri.ToString();
            formData.Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}";

            if (ExecutingUser == null)
            {
                throw new Exception(ErrorResource.NullExecutingUser);
            }

            try
            {
                // Execute in its own thread to give proper context
                var t = new Thread(() =>
                {
                    Thread.CurrentPrincipal = ExecutingUser;

                    var responseWriter = CreateForm(formData, serviceName, workspaceId, ctx.FetchHeaders(), ctx.Request.User);
                    ctx.Send(responseWriter);
                });

                t.Start();
                t.Join();
            }
            catch (Exception e)
            {
                Dev2Logger.Error(this, e, GlobalConstants.WarewolfError);
            }
        }
コード例 #4
0
 protected static string GetInstanceID(ICommunicationContext ctx) => ctx.GetInstanceID();
コード例 #5
0
 protected static string GetInstanceID(ICommunicationContext ctx)
 {
     return(ctx.GetInstanceID());
 }