Example #1
0
        public static IHttpAction CreateAction(IHttpActionContext context)
        {
            var action = CreateActionPrivate(context, null, null, null, null, null);

            context.CurrentAction = action;
            return(action);
        }
Example #2
0
 public IDefaultHttpAction CreateDefaultAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode)
 {
     return(new DefaultHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode
     });
 }
Example #3
0
 public IDefaultHttpAction CreateDefaultAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode)
 {
     return new DefaultHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode
     };
 }
Example #4
0
 public IRewriteHttpAction CreateRewriteAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, string path)
 {
     return new RewriteHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         Path = path
     };
 }
Example #5
0
 public IRewriteHttpAction CreateRewriteAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, string path)
 {
     return(new RewriteHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         Path = path
     });
 }
Example #6
0
 public IRemapHttpAction CreateRemapAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, NodeHead httpHandlerNode)
 {
     return(new RemapHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         HttpHandlerNode = httpHandlerNode
     });
 }
Example #7
0
 public IRemapHttpAction CreateRemapAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, NodeHead httpHandlerNode)
 {
     return new RemapHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         HttpHandlerNode = httpHandlerNode
     };
 }
Example #8
0
 public IDownloadHttpAction CreateDownloadAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, string path, string binaryPropertyName)
 {
     return(new DownloadHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         Path = path,
         BinaryPropertyName = binaryPropertyName
     });
 }
Example #9
0
 public IRewriteHttpAction CreateRewriteAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, string filePath, string pathInfo, string queryString)
 {
     return(new RewriteHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         FilePath = filePath,
         PathInfo = pathInfo,
         QueryString = queryString
     });
 }
Example #10
0
 public IRedirectHttpAction CreateRedirectAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, string targetUrl, bool permanent, bool endResponse)
 {
     return(new RedirectHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         TargetUrl = targetUrl,
         Permanent = permanent,
         EndResponse = endResponse,
     });
 }
Example #11
0
 public IRedirectHttpAction CreateRedirectAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, string targetUrl, bool permanent, bool endResponse)
 {
     return new RedirectHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         TargetUrl = targetUrl,
         Permanent = permanent,
         EndResponse = endResponse,
     };
 }
Example #12
0
 public IRewriteHttpAction CreateRewriteAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, string filePath, string pathInfo, string queryString)
 {
     return new RewriteHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         FilePath = filePath,
         PathInfo = pathInfo,
         QueryString = queryString
     };
 }
Example #13
0
        private static string GetLoggedProperties(IHttpActionContext context)
        {
            var sb     = new StringBuilder();
            var action = context.CurrentAction;

            sb.Append("ActionType: ").Append(action.GetType().Name).Append(", ");
            sb.Append("TargetNode: ").Append(action.TargetNode == null ? "[null]" : action.TargetNode.Path).Append(", ");
            sb.Append("AppNode: ").Append(action.AppNode == null ? "[null]" : action.AppNode.Path);

            if (action is DefaultHttpAction)
            {
                sb.Append(", RequestUrl:").Append(context.RequestedUrl);
            }

            var redirectAction = action as RedirectHttpAction;

            if (redirectAction != null)
            {
                sb.Append(", TargetUrl:").Append(redirectAction.TargetUrl);
                sb.Append(", EndResponse:").Append(redirectAction.EndResponse);
                return(sb.ToString());
            }

            var remapAction = action as RemapHttpAction;

            if (remapAction != null)
            {
                if (remapAction.HttpHandlerType != null)
                {
                    sb.Append(", HttpHandlerType:").Append(remapAction.HttpHandlerType.Name);
                }
                else
                {
                    sb.Append(", HttpHandlerNode:").Append(remapAction.HttpHandlerNode.Path);
                }
                return(sb.ToString());
            }

            var rewriteAction = action as RewriteHttpAction;

            if (rewriteAction != null)
            {
                sb.Append(", Path:").Append(rewriteAction.Path);
            }

            return(sb.ToString());
        }
Example #14
0
        private static IDictionary <string, object> CollectLoggedProperties(IHttpActionContext context)
        {
            var action = context.CurrentAction;
            var props  = new Dictionary <string, object>
            {
                { "ActionType", action.GetType().Name },
                { "TargetNode", action.TargetNode == null ? "[null]" : action.TargetNode.Path },
                { "AppNode", action.AppNode == null ? "[null]" : action.AppNode.Path }
            };

            if (action is DefaultHttpAction)
            {
                props.Add("RequestUrl", context.RequestedUrl);
                return(props);
            }
            var redirectAction = action as RedirectHttpAction;

            if (redirectAction != null)
            {
                props.Add("TargetUrl", redirectAction.TargetUrl);
                props.Add("EndResponse", redirectAction.EndResponse);
                return(props);
            }
            var remapAction = action as RemapHttpAction;

            if (remapAction != null)
            {
                if (remapAction.HttpHandlerType != null)
                {
                    props.Add("HttpHandlerType", remapAction.HttpHandlerType.Name);
                }
                else
                {
                    props.Add("HttpHandlerNode", remapAction.HttpHandlerNode.Path);
                }
                return(props);
            }
            var rewriteAction = action as RewriteHttpAction;

            if (rewriteAction != null)
            {
                props.Add("Path", rewriteAction.Path);
                return(props);
            }
            return(props);
        }
Example #15
0
        private static IHttpAction CreateActionPrivate(IHttpActionContext actionContext, IHttpActionFactory actionFactory, NodeHead requestedNode, string requestedActionName, string requestedApplicationNodePath, string requestedDevice)
        {
            IHttpAction action = null;

            var factory       = actionFactory ?? actionContext.GetActionFactory();
            var contextNode   = requestedNode ?? actionContext.GetRequestedNode();
            var actionName    = requestedActionName ?? actionContext.RequestedActionName;
            var appNodePath   = requestedApplicationNodePath ?? actionContext.RequestedApplicationNodePath;
            var portalContext = (PortalContext)actionContext;

            // ================================================= #1: preconditions

            action = GetODataAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            // webdav request?
            action = GetWebdavAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            // ----------------------------------------------- forward to start page if context is a Site

            action = GetSiteStartPageAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            // ----------------------------------------------- smart url

            action = GetSmartUrlAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            // ----------------------------------------------- outer resource

            action = GetExternalResourceAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            // ----------------------------------------------- context is external page

            action = GetExternalPageAction(factory, portalContext, contextNode, actionName, appNodePath);
            if (action != null)
            {
                return(action);
            }

            // ----------------------------------------------- context is IHttpHandlerNode

            if (string.IsNullOrEmpty(actionName))
            {
                action = GetIHttpHandlerAction(factory, portalContext, contextNode, contextNode);
                if (action != null)
                {
                    return(action);
                }
            }

            // ----------------------------------------------- default context action

            action = GetDefaultContextAction(factory, portalContext, contextNode, actionName, appNodePath);
            if (action != null)
            {
                return(action);
            }

            // ================================================= #2: FindApplication(node, action);

            var appNode = FindApplication(contextNode, actionName, appNodePath, actionContext.DeviceName);

            if (appNode == null)
            {
                return(factory.CreateRewriteAction(actionContext, contextNode, null, GetRewritePath(contextNode, portalContext)));
            }

            // ----------------------------------------------- AppNode is IHttpHandlerNode

            action = GetIHttpHandlerAction(factory, portalContext, contextNode, appNode);
            if (action != null)
            {
                return(action);
            }

            // ----------------------------------------------- page and site

            return(factory.CreateRewriteAction(actionContext, contextNode, appNode, GetRewritePath(appNode, portalContext)));
        }
Example #16
0
        private static IHttpAction CreateActionPrivate(IHttpActionContext actionContext, IHttpActionFactory actionFactory, NodeHead requestedNode, string requestedActionName, string requestedApplicationNodePath, string requestedDevice)
        {
            IHttpAction action = null;

            var factory = actionFactory ?? actionContext.GetActionFactory();
            var contextNode = requestedNode ?? actionContext.GetRequestedNode();
            var actionName = requestedActionName ?? actionContext.RequestedActionName;
            var appNodePath = requestedApplicationNodePath ?? actionContext.RequestedApplicationNodePath;
            var portalContext = (PortalContext)actionContext;

            //================================================= #1: preconditions

            action = GetFirstRunAction(factory, portalContext, contextNode);
            if (action != null)
                return action;

            // webdav request?
            action = GetWebdavAction(factory, portalContext, contextNode);
            if (action != null)
                return action;

            /*
            //---- Uncomment and recompile to support *.SVC on IIS5.1
            action = (GetIIS5SVCRequestAction(portalContext, httpContext));
            if (action != null)
                return action;
            */

            //----------------------------------------------- forward to start page if context is a Site

            action = GetSiteStartPageAction(factory, portalContext, contextNode);
            if (action != null)
                return action;

            //----------------------------------------------- smart url

            action = GetSmartUrlAction(factory, portalContext, contextNode);
            if (action != null)
                return action;

            //----------------------------------------------- outer resource

            action = GetExternalResourceAction(factory, portalContext, contextNode);
            if (action != null)
                return action;

            //----------------------------------------------- context is external page

            action = GetExternalPageAction(factory, portalContext, contextNode, actionName, appNodePath);
            if (action != null)
                return action;

            //----------------------------------------------- context is IHttpHandlerNode

            if (string.IsNullOrEmpty(actionName))
            {
                action = GetIHttpHandlerAction(factory, portalContext, contextNode, contextNode);
                if (action != null)
                    return action;
            }

            //----------------------------------------------- default context action

            action = GetDefaultContextAction(factory, portalContext, contextNode, actionName, appNodePath);
            if (action != null)
                return action;

            //================================================= #2: FindApplication(node, action);

            var appNode = FindApplication(contextNode, actionName, appNodePath, actionContext.DeviceName);
            if (appNode == null)
                return factory.CreateRewriteAction(actionContext, contextNode, null, GetRewritePath(contextNode, portalContext));

            portalContext.BackwardCompatibility_SetPageRepositoryPath(appNode.Path);

            //-----------------------------------------------

            //TODO: appNode external page check?

            //----------------------------------------------- AppNode is IHttpHandlerNode 

            action = GetIHttpHandlerAction(factory, portalContext, contextNode, appNode);
            if (action != null)
                return action;

            //----------------------------------------------- page and site

            return factory.CreateRewriteAction(actionContext, contextNode, appNode, GetRewritePath(appNode, portalContext));
        }
Example #17
0
 public static IHttpAction CreateAction(IHttpActionContext context)
 {
     var action = CreateActionPrivate(context, null, null, null, null, null);
     context.CurrentAction = action;
     return action;
 }
Example #18
0
 public IDownloadHttpAction CreateDownloadAction(IHttpActionContext context, NodeHead targetNode, NodeHead appNode, string path, string binaryPropertyName)
 {
     return new DownloadHttpAction
     {
         Context = context,
         TargetNode = targetNode,
         AppNode = appNode,
         Path = path,
         BinaryPropertyName = binaryPropertyName
     };
 }
Example #19
0
        private static IHttpAction CreateActionPrivate(IHttpActionContext actionContext, IHttpActionFactory actionFactory, NodeHead requestedNode, string requestedActionName, string requestedApplicationNodePath, string requestedDevice)
        {
            IHttpAction action = null;

            var factory       = actionFactory ?? actionContext.GetActionFactory();
            var contextNode   = requestedNode ?? actionContext.GetRequestedNode();
            var actionName    = requestedActionName ?? actionContext.RequestedActionName;
            var appNodePath   = requestedApplicationNodePath ?? actionContext.RequestedApplicationNodePath;
            var portalContext = (PortalContext)actionContext;

            //================================================= #1: preconditions

            action = GetFirstRunAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            // webdav request?
            action = GetWebdavAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            /*
             * //---- Uncomment and recompile to support *.SVC on IIS5.1
             * action = (GetIIS5SVCRequestAction(portalContext, httpContext));
             * if (action != null)
             *  return action;
             */

            //----------------------------------------------- forward to start page if context is a Site

            action = GetSiteStartPageAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            //----------------------------------------------- smart url

            action = GetSmartUrlAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            //----------------------------------------------- outer resource

            action = GetExternalResourceAction(factory, portalContext, contextNode);
            if (action != null)
            {
                return(action);
            }

            //----------------------------------------------- context is external page

            action = GetExternalPageAction(factory, portalContext, contextNode, actionName, appNodePath);
            if (action != null)
            {
                return(action);
            }

            //----------------------------------------------- context is IHttpHandlerNode

            if (string.IsNullOrEmpty(actionName))
            {
                action = GetIHttpHandlerAction(factory, portalContext, contextNode, contextNode);
                if (action != null)
                {
                    return(action);
                }
            }

            //----------------------------------------------- default context action

            action = GetDefaultContextAction(factory, portalContext, contextNode, actionName, appNodePath);
            if (action != null)
            {
                return(action);
            }

            //================================================= #2: FindApplication(node, action);

            var appNode = FindApplication(contextNode, actionName, appNodePath, actionContext.DeviceName);

            if (appNode == null)
            {
                return(factory.CreateRewriteAction(actionContext, contextNode, null, GetRewritePath(contextNode, portalContext)));
            }

            portalContext.BackwardCompatibility_SetPageRepositoryPath(appNode.Path);

            //-----------------------------------------------

            //TODO: appNode external page check?

            //----------------------------------------------- AppNode is IHttpHandlerNode

            action = GetIHttpHandlerAction(factory, portalContext, contextNode, appNode);
            if (action != null)
            {
                return(action);
            }

            //----------------------------------------------- page and site

            return(factory.CreateRewriteAction(actionContext, contextNode, appNode, GetRewritePath(appNode, portalContext)));
        }
Example #20
0
        private static IDictionary<string, object> CollectLoggedProperties(IHttpActionContext context)
        {
            var action = context.CurrentAction;
            var props = new Dictionary<string, object>
                {
                    {"ActionType", action.GetType().Name},
                    {"TargetNode",  action.TargetNode == null ? "[null]" : action.TargetNode.Path},
                    {"AppNode",  action.AppNode == null ? "[null]" : action.AppNode.Path}
                };

            if (action is DefaultHttpAction)
            {
                props.Add("RequestUrl", context.RequestedUrl);
                return props;
            }
            var redirectAction = action as RedirectHttpAction;
            if (redirectAction != null)
            {
                props.Add("TargetUrl", redirectAction.TargetUrl);
                props.Add("EndResponse", redirectAction.EndResponse);
                return props;
            }
            var remapAction = action as RemapHttpAction;
            if (remapAction != null)
            {
                if (remapAction.HttpHandlerType != null)
                    props.Add("HttpHandlerType", remapAction.HttpHandlerType.Name);
                else
                    props.Add("HttpHandlerNode", remapAction.HttpHandlerNode.Path);
                return props;
            }
            var rewriteAction = action as RewriteHttpAction;
            if (rewriteAction != null)
            {
                props.Add("Path", rewriteAction.Path);
                return props;
            }
            return props;
        }