Example #1
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 #2
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 #3
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));
        }