Esempio n. 1
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var postDataListID = GetDataListID(ctx);
            if(postDataListID != null)
            {
                new WebPostRequestHandler().ProcessRequest(ctx);
                return;
            }

            var serviceName = GetServiceName(ctx);
            var workspaceID = GetWorkspaceID(ctx);

            var requestTO = new WebRequestTO { ServiceName = serviceName, WebServerUrl = ctx.Request.Uri.ToString(), Dev2WebServer = String.Format("{0}://{1}", ctx.Request.Uri.Scheme, ctx.Request.Uri.Authority) };
            var data = 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]);
                }
            }
            // Execute in its own thread to give proper context ;)
            Thread.CurrentPrincipal = ctx.Request.User;

            var responseWriter = CreateForm(requestTO, serviceName, workspaceID, ctx.FetchHeaders());
            ctx.Send(responseWriter);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var postDataListID = GetDataListID(ctx);

            if (postDataListID != null)
            {
                new WebPostRequestHandler().ProcessRequest(ctx);
                return;
            }

            var serviceName = GetServiceName(ctx);
            var workspaceID = GetWorkspaceID(ctx);

            var requestTO = new WebRequestTO {
                ServiceName = serviceName, WebServerUrl = ctx.Request.Uri.ToString(), Dev2WebServer = String.Format("{0}://{1}", ctx.Request.Uri.Scheme, ctx.Request.Uri.Authority)
            };
            var data = GetPostData(ctx, Guid.Empty.ToString());

            if (!String.IsNullOrEmpty(data))
            {
                requestTO.RawRequestPayload = data;
            }

            // Execute in its own thread to give proper context ;)
            Thread.CurrentPrincipal = ctx.Request.User;

            var responseWriter = CreateForm(requestTO, serviceName, workspaceID, ctx.FetchHeaders(), PublicFormats);

            ctx.Send(responseWriter);
        }
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var serviceName = GetServiceName(ctx);
            var instanceId = GetInstanceID(ctx);
            var bookmark = GetBookmark(ctx);
            var postDataListID = GetDataListID(ctx);
            var workspaceID = GetWorkspaceID(ctx);

            var requestTO = new WebRequestTO();
            var xml = GetPostData(ctx, postDataListID);

            if(!String.IsNullOrEmpty(xml))
            {
                requestTO.RawRequestPayload = xml;
            }

            requestTO.ServiceName = serviceName;
            requestTO.InstanceID = instanceId;
            requestTO.Bookmark = bookmark;
            requestTO.WebServerUrl = ctx.Request.Uri.ToString();
            requestTO.Dev2WebServer = String.Format("{0}://{1}", ctx.Request.Uri.Scheme, ctx.Request.Uri.Authority);


            // Execute in its own thread to give proper context ;)
            Thread.CurrentPrincipal = ctx.Request.User;

            var responseWriter = CreateForm(requestTO, serviceName, workspaceID, ctx.FetchHeaders(), PublicFormats, ctx.Request.User);
            ctx.Send(responseWriter);

        }
Esempio n. 5
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var serviceName    = GetServiceName(ctx);
            var instanceId     = GetInstanceID(ctx);
            var bookmark       = GetBookmark(ctx);
            var postDataListID = GetDataListID(ctx);
            var workspaceID    = GetWorkspaceID(ctx);

            var requestTO = new WebRequestTO();
            var xml       = GetPostData(ctx, postDataListID);

            if (!String.IsNullOrEmpty(xml))
            {
                requestTO.RawRequestPayload = xml;
            }

            requestTO.ServiceName   = serviceName;
            requestTO.InstanceID    = instanceId;
            requestTO.Bookmark      = bookmark;
            requestTO.WebServerUrl  = ctx.Request.Uri.ToString();
            requestTO.Dev2WebServer = String.Format("{0}://{1}", ctx.Request.Uri.Scheme, ctx.Request.Uri.Authority);


            // Execute in its own thread to give proper context ;)
            Thread.CurrentPrincipal = ctx.Request.User;

            var responseWriter = CreateForm(requestTO, serviceName, workspaceID, ctx.FetchHeaders(), PublicFormats, ctx.Request.User);

            ctx.Send(responseWriter);
        }
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var serviceName = GetServiceName(ctx);
            var instanceId = GetInstanceID(ctx);
            var bookmark = GetBookmark(ctx);
            GetDataListID(ctx);
            var workspaceID = GetWorkspaceID(ctx);
            var formData = new WebRequestTO();

            var xml = 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 = String.Format("{0}://{1}", ctx.Request.Uri.Scheme, ctx.Request.Uri.Authority);

            if(ExecutingUser == null)
            {
                throw new Exception("Null Executing User");
            }

            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)
            {
                // ReSharper disable InvokeAsExtensionMethod
                Dev2Logger.Log.Error(this, e);
                // ReSharper restore InvokeAsExtensionMethod
            }
        }
        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;
            }
        }
Esempio n. 8
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var postDataListId = ctx.GetDataListID();

            if (postDataListId != null)
            {
                new WebPostRequestHandler(_resourceCatalog, _testCatalog, _testCoverageCatalog, _esbChannelFactory).ProcessRequest(ctx);
                return;
            }

            var serviceName = ctx.GetServiceName();
            var workspaceId = ctx.GetWorkspaceID();

            var requestTo = new WebRequestTO
            {
                ServiceName          = serviceName,
                WebServerUrl         = ctx.Request.Uri.ToString(),
                Dev2WebServer        = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}",
                IsUrlWithTokenPrefix = ctx.Request.IsTokenAuthentication
            };
            var data = new 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]);
                }
            }
            // Execute in its own thread to give proper context ;)
            Thread.CurrentPrincipal = ctx.Request.User;

            var responseWriter = CreateForm(requestTo, serviceName, workspaceId, ctx.FetchHeaders(), ctx.Request.User);

            ctx.Send(responseWriter);
        }
Esempio n. 9
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var postDataListID = ctx.GetDataListID();

            if (postDataListID != null)
            {
                _catalog     = _catalog ?? ResourceCatalog.Instance;
                _testCatalog = _testCatalog ?? TestCatalog.Instance;
                new WebPostRequestHandler(_catalog, _testCatalog).ProcessRequest(ctx);
                return;
            }

            var serviceName = ctx.GetServiceName();
            var workspaceID = ctx.GetWorkspaceID();

            var requestTO = new WebRequestTO {
                ServiceName = serviceName, WebServerUrl = ctx.Request.Uri.ToString(), 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]);
                }
            }
            // Execute in its own thread to give proper context ;)
            Thread.CurrentPrincipal = ctx.Request.User;

            var responseWriter = CreateForm(requestTO, serviceName, workspaceID, ctx.FetchHeaders(), ctx.Request.User);

            ctx.Send(responseWriter);
        }
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var serviceName = GetServiceName(ctx);
            var instanceId  = GetInstanceID(ctx);
            var bookmark    = GetBookmark(ctx);

            GetDataListID(ctx);
            var workspaceID = GetWorkspaceID(ctx);
            var formData    = new WebRequestTO();

            var xml = 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 = String.Format("{0}://{1}", ctx.Request.Uri.Scheme, ctx.Request.Uri.Authority);

            if (ExecutingUser == null)
            {
                throw new Exception("Null Executing User");
            }

            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)
            {
                // ReSharper disable InvokeAsExtensionMethod
                Dev2Logger.Log.Error(this, e);
                // ReSharper restore InvokeAsExtensionMethod
            }
        }
        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);
            }
        }