using System.Web.Util;
using System.Web.Compilation;
-#if TARGET_J2EE
-using vmw.common;
-#else
using System.CodeDom.Compiler;
-#endif
namespace System.Web
{
object this_lock = new object ();
// Initialized in InitType
-#if TARGET_J2EE
- static HttpApplicationFactory theFactory {
- get
- {
- HttpApplicationFactory factory = (HttpApplicationFactory)AppDomain.CurrentDomain.GetData("HttpApplicationFactory");
- if (factory == null) {
- lock(typeof(HttpApplicationFactory)) {
- factory = (HttpApplicationFactory)AppDomain.CurrentDomain.GetData("HttpApplicationFactory");
- if (factory == null) {
- factory = new HttpApplicationFactory();
- System.Threading.Thread.Sleep(1);
- AppDomain.CurrentDomain.SetData("HttpApplicationFactory", factory);
- }
- }
- }
- return factory;
- }
- }
-#else
static HttpApplicationFactory theFactory = new HttpApplicationFactory();
-#endif
object session_end; // This is a MethodInfo
bool needs_init = true;
bool app_start_needed = true;
}
internal static HttpApplicationState ApplicationState {
-#if TARGET_J2EE
- get {
- HttpApplicationFactory factory = theFactory;
- if (factory.app_state == null)
- factory.app_state = new HttpApplicationState (null, null);
- return factory.app_state;
- }
-#else
get {
if (theFactory.app_state == null) {
HttpStaticObjectsCollection app = MakeStaticCollection (GlobalAsaxCompiler.ApplicationObjects);
}
return theFactory.app_state;
}
-#endif
}
internal static Type AppType {
if (!File.Exists (app_file))
app_file = null;
}
-#if NET_4_0
BuildManager.CallPreStartMethods ();
-#endif
-#if !TARGET_J2EE
+ BuildManager.CompilingTopLevelAssemblies = true;
AppResourcesCompiler ac = new AppResourcesCompiler (context);
ac.Compile ();
if (Directory.Exists (app_browsers_path)) {
app_browsers_files = Directory.GetFiles (app_browsers_path, "*.browser");
}
-#endif
-
+ BuildManager.CompilingTopLevelAssemblies = false;
app_type = BuildManager.GetPrecompiledApplicationType ();
if (app_type == null && app_file != null) {
-#if TARGET_J2EE
- app_file = System.Web.Util.UrlUtils.ResolveVirtualPathFromAppAbsolute("~/" + Path.GetFileName(app_file));
- app_type = System.Web.J2EE.PageMapper.GetObjectType(context, app_file);
-#else
app_type = BuildManager.GetCompiledType ("~/" + Path.GetFileName (app_file));
-#endif
if (app_type == null) {
string msg = String.Format ("Error compiling application file ({0}).", app_file);
throw new ApplicationException (msg);
//
internal static HttpApplication GetApplication (HttpContext context)
{
-#if TARGET_J2EE
- if (context.ApplicationInstance!=null)
- return context.ApplicationInstance;
-#endif
HttpApplicationFactory factory = theFactory;
HttpApplication app = null;
if (factory.app_start_needed){