private bool IsApplication(NodeHead appNode) { var type = TypeHandler.GetType(appNode.GetNodeType().ClassName); //if (typeof(Page).IsAssignableFrom(type)) // return true; //if (typeof(IHttpHandler).IsAssignableFrom(type)) // return true; return typeof(Application).IsAssignableFrom(type); }
//--------------------------------------------------------------------- private static string GetRewritePath(NodeHead appNodeHead, PortalContext portalContext) { if (!String.IsNullOrEmpty(portalContext.QueryStringNodePropertyName)) return appNodeHead.Path; NodeType contextNodeType = appNodeHead.GetNodeType(); if (contextNodeType.IsInstaceOfOrDerivedFrom("Page")) return appNodeHead.Path + PortalContext.InRepositoryPageSuffix; //else if (contextNodeType.IsInstaceOfOrDerivedFrom("GenericContent") && !contextNodeType.IsInstaceOfOrDerivedFrom("File")) // return appNodeHead.Path + PortalContext.InRepositoryPageSuffix; else if (contextNodeType.IsInstaceOfOrDerivedFrom("Site")) throw new NotSupportedException("/*!!!*/"); return appNodeHead.Path; }
private static IHttpAction GetDefaultContextAction(IHttpActionFactory factory, PortalContext portalContext, NodeHead contextNode, string actionName, string appNodePath) { if (String.IsNullOrEmpty(actionName) && String.IsNullOrEmpty(appNodePath)) { if(!String.IsNullOrEmpty(portalContext.QueryStringNodePropertyName)) return factory.CreateDownloadAction(portalContext, contextNode, null, GetRewritePath(contextNode, portalContext), portalContext.QueryStringNodePropertyName); var nodeType = contextNode.GetNodeType(); if (nodeType.IsInstaceOfOrDerivedFrom("Page")) return factory.CreateRewriteAction(portalContext, contextNode, null, GetRewritePath(contextNode, portalContext)); if (nodeType.IsInstaceOfOrDerivedFrom("File")) return factory.CreateDownloadAction(portalContext, contextNode, null, GetRewritePath(contextNode, portalContext), PortalContext.DefaultNodePropertyName); } return null; }
private static IHttpAction GetIHttpHandlerAction(IHttpActionFactory factory, PortalContext portalContext, NodeHead contextNode, NodeHead handlerNode) { var nodeType = handlerNode.GetNodeType(); Type appType = TypeHandler.GetType(nodeType.ClassName); if (typeof(IHttpHandler).IsAssignableFrom(appType)) return factory.CreateRemapAction(portalContext, contextNode, null, handlerNode); return null; }
private static IHttpAction GetSiteStartPageAction(IHttpActionFactory factory, PortalContext portalContext, NodeHead contextNode) { if (contextNode == null) return null; if (!contextNode.GetNodeType().IsInstaceOfOrDerivedFrom("Site")) return null; //var startPage = portalContext.Site.StartPage; Page startPage = null; using (new SystemAccount()) { var contextSite = Node.Load<Site>(contextNode.Id); if (contextSite != null && (portalContext.ActionName == null || portalContext.ActionName.ToLower() == "browse")) startPage = contextSite.StartPage; if (startPage == null) return null; } var relPath = startPage.Path.Replace(portalContext.Site.Path, ""); return factory.CreateRedirectAction(portalContext, contextNode, null, relPath, false, true); }
public static bool IsApplicationNode(NodeHead nodeHead) { return IsApplicationNodeType(nodeHead.GetNodeType()); }