Exemplo n.º 1
0
        static ICachedXmlDoc GetAssembliesCachedDocument(HttpContext context)
        {
            ICachedXmlDoc doc = (ICachedXmlDoc)AppDomain.CurrentDomain.GetData(J2EEConsts.ASSEMBLIES_FILE);

            if (doc == null)
            {
                lock (LOCK_GETASSEMBLIESCACHEDDOCUMENT) {
                    doc = (ICachedXmlDoc)AppDomain.CurrentDomain.GetData(J2EEConsts.ASSEMBLIES_FILE);
                    if (doc == null)
                    {
                        doc = CreateDocument();
                        if (doc != null)
                        {
                            AppDomain.CurrentDomain.SetData(J2EEConsts.ASSEMBLIES_FILE, doc);

                            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
                            try {
                                //Try to load the  global resources
                                HttpContext.AppGlobalResourcesAssembly = GetCachedAssembly(context, context.Request.ApplicationPath + "/app_globalresources");
                            }
                            catch (Exception ex) {
                                Debug.WriteLine(ex.ToString());
                            }
                        }
                    }
                }
            }

            return(doc);
        }
Exemplo n.º 2
0
        static Type GetCachedType(HttpContext context, string url, bool throwException)
        {
            ICachedXmlDoc doc = PageMapper.GetAssembliesCachedDocument(context);
            Type          t   = doc.GetType(context, url);

            if (t == null && throwException)
            {
                throw new HttpException(404, "The requested resource (" + url + ") is not available.");
            }

            return(t);
        }
Exemplo n.º 3
0
        static Assembly GetCachedAssembly(HttpContext context, string url)
        {
            ICachedXmlDoc doc = PageMapper.GetAssembliesCachedDocument(context);

            return(doc.GetAssembly(context, url));
        }
Exemplo n.º 4
0
        static string GetCachedResource(HttpContext context, string url)
        {
            ICachedXmlDoc doc = PageMapper.GetAssembliesCachedDocument(context);

            return(doc.GetAssemblyResourceName(context, url));
        }