/** * initialize the script manager. */ public override void init(ServletConfig config) { _config = config; _servletContext = config.getServletContext(); checkServletAPIVersion(); string pwd = new FilePath(_servletContext.getRealPath("/")); string webInfDir = new FilePath(_servletContext.getRealPath("/WEB-INF")); getQuercus().setPwd(pwd); getQuercus().setWebInfDir(webInfDir); // need to set these for non-Resin containers if (!CurrentTime.isTest() && !getQuercus().isResin()) { Vfs.setPwd(pwd); WorkDir.setLocalWorkDir(webInfDir.lookup("work")); } initImpl(config); getQuercus().init(); getQuercus().start(); }
override public void init(ServletConfig config) { base.init(config); AppDir = config.getServletContext ().getInitParameter (IAppDomainConfig.APP_DIR_NAME); if (AppDir != null) { AppDir = AppDir.Replace('\\', '/'); if (AppDir[AppDir.Length - 1] != '/') AppDir += '/'; } }
override public void init(ServletConfig config) { base.init(config); AppDir = config.getServletContext().getInitParameter(IAppDomainConfig.APP_DIR_NAME); if (AppDir != null) { AppDir = AppDir.Replace('\\', '/'); if (AppDir[AppDir.Length - 1] != '/') { AppDir += '/'; } } }
public static void InitRuntime(ServletConfig config, object evidence) { ServletContext context = config.getServletContext(); if (context.getAttribute(J2EEConsts.APP_DOMAIN) != null) { return; } _facesContextFactory = (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); //TODO: null-check for Weblogic, that tries to initialize Servlet before ContextListener //Javadoc says: Lifecycle instance is shared across multiple simultaneous requests, it must be implemented in a thread-safe manner. //So we can acquire it here once: LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); _lifecycle = lifecycleFactory.getLifecycle(context.getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR) ?? LifecycleFactory.DEFAULT_LIFECYCLE); _renderKitFactory = (RenderKitFactory)FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY); AppDomain servletDomain = createServletDomain(config); [email protected](servletDomain); try { //GH Infromation Initizalization long currentTime = java.lang.System.currentTimeMillis(); servletDomain.SetData(".domainId", currentTime.ToString("x")); currentTime = ~currentTime; servletDomain.SetData(".appId", currentTime.ToString("x")); servletDomain.SetData(".appName", servletDomain.SetupInformation.ApplicationName); servletDomain.SetData(J2EEConsts.CLASS_LOADER, java.lang.Thread.currentThread().getContextClassLoader()); //servletDomain.SetData (J2EEConsts.CLASS_LOADER, vmw.common.TypeUtils.ToClass (evidence).getClassLoader ()); //servletDomain.SetData(J2EEConsts.SERVLET_CONFIG, config); servletDomain.SetData(J2EEConsts.RESOURCE_LOADER, new ServletResourceLoader(context)); lock (evidence) { if (context.getAttribute(J2EEConsts.APP_DOMAIN) == null) { context.setAttribute(J2EEConsts.APP_DOMAIN, servletDomain); } } //config.getServletContext ().setAttribute (J2EEConsts.CURRENT_SERVLET, this); } finally { [email protected](); [email protected](); } }
public override void init(ServletConfig config) { super.init(config); _context = config.getServletContext(); _cache = new LruCache <String, CacheEntry>(1024); _pwd = new FilePath(_context.getRealPath("/")); string mode = System.getProperty("com.google.appengine.tools.development.ApplicationPreparationMode"); bool isGsDisabled = "true".equals(mode); if (!isGsDisabled) { string iniPath = getInitParameter("ini-file"); if (iniPath != null) { string realPath = _context.getRealPath(iniPath); // don't call Quercus.init() as that will load all the modules for calling // from PHP code, which we don't use nor want GoogleQuercus quercus = new GoogleQuercus(); quercus.setIniFile(_pwd.lookup(realPath)); _gsBucket = quercus.getIniString("google.cloud_storage_bucket"); if (_gsBucket != null) { _pwd = new GoogleMergePath(_pwd, _gsBucket, true); } } } log.log(Level.INFO, L.l("{0} initialized with bucket={1},pwd={2}", getClass().getSimpleName(), _gsBucket, _pwd.getUserPath())); }
public KeyValueMergedCollection(HttpContext hc, NameValueCollection wrapped) : base(wrapped) { _wrapped = wrapped; ServletConfig config = (ServletConfig)AppDomain.CurrentDomain.GetData(vmw.common.IAppDomainConfig.SERVLET_CONFIG); if (config != null) { ServletContext context = config.getServletContext(); for (java.util.Enumeration e = context.getInitParameterNames(); e.hasMoreElements();) { string key = (string)e.nextElement(); Set(key, context.getInitParameter(key)); } for (java.util.Enumeration e = config.getInitParameterNames(); e.hasMoreElements();) { string key = (string)e.nextElement(); Set(key, config.getInitParameter(key)); } } }
override public void init(ServletConfig config) { base.init(config); InitRuntime (config, this); }
override public void init (ServletConfig config) { base.init (config); staticServlet.init (config); }
private static AppDomain createServletDomain(ServletConfig config) { string rootPath = J2EEUtils.GetApplicationRealPath(config.getServletContext ()); AppDomainSetup domainSetup = new AppDomainSetup(); string name = config.getServletName();//.getServletContextName(); if (name == null) name = "GH Application"; domainSetup.ApplicationName = name; domainSetup.ConfigurationFile = Path.Combine (rootPath, "Web.config"); domainSetup.PrivateBinPath = Path.Combine (rootPath, "WEB-INF/lib"); AppDomain servletDomain = AppDomain.CreateDomain(name, null, domainSetup); //servletDomain.SetData(IAppDomainConfig.APP_PHYS_DIR, J2EEUtils.GetApplicationPhysicalPath(config)); //servletDomain.SetData(IAppDomainConfig.WEB_APP_DIR, rootPath); servletDomain.SetData(IAppDomainConfig.APP_PHYS_DIR, J2EEUtils.GetApplicationPhysicalPath(config.getServletContext ())); servletDomain.SetData(IAppDomainConfig.WEB_APP_DIR, rootPath); servletDomain.SetData(IAppDomainConfig.SERVLET_CONFIG, config); //Set DataDirectory substitution string (http://blogs.msdn.com/dataaccess/archive/2005/10/28/486273.aspx) string dataDirectory = config.getServletContext ().getInitParameter ("DataDirectory"); if (dataDirectory == null) dataDirectory = "App_Data"; if (!Path.IsPathRooted (dataDirectory)) { java.io.InputStream inputStream = config.getServletContext ().getResourceAsStream ("/WEB-INF/classes/appData.properties"); string root; if (inputStream != null) { try { Properties props = new Properties (); props.load (inputStream); root = props.getProperty ("root.folder"); } finally { inputStream.close (); } } else root = config.getServletContext ().getRealPath ("/"); if (root == null) root = String.Empty; dataDirectory = Path.Combine (root, dataDirectory); } if (dataDirectory [dataDirectory.Length - 1] != Path.DirectorySeparatorChar) dataDirectory += Path.DirectorySeparatorChar; servletDomain.SetData ("DataDirectory", dataDirectory); if (config.getServletContext ().getRealPath ("/") == null) servletDomain.SetData(".appStartTime", DateTime.UtcNow); // The BaseDir is the full path to the physical dir of the app // and allows the application to modify files in the case of // open deployment. string webApp_baseDir = config.getServletContext().getRealPath(""); if (webApp_baseDir == null || webApp_baseDir == "") webApp_baseDir = rootPath; servletDomain.SetData(IAppDomainConfig.APP_BASE_DIR , webApp_baseDir); Debug.WriteLine("Initialization of webapp " + webApp_baseDir); //servletDomain.SetData(".hostingVirtualPath", "/"); //servletDomain.SetData(".hostingInstallDir", "/"); return servletDomain; }
/// <summary> /// Returns a <code>String</code> containing the value of the named /// initialization parameter, or <code>null</code> if the parameter does /// not exist. See {@link ServletConfig#getInitParameter}. /// /// This method is supplied for convenience. It gets the /// value of the named parameter from the servlet's /// <code>ServletConfig</code> object. /// </summary> /// <param name="name">a string specifying the name of the initialization parameter</param> /// <returns>a string containing the value of the initialization parameter</returns> public string GetInitParameter(string name) { return(ServletConfig.GetInitParameter(name)); }
override public void init(ServletConfig config) { base.init(config); staticServlet.init(config); }
private static AppDomain createServletDomain(ServletConfig config) { string rootPath = J2EEUtils.GetApplicationRealPath(config.getServletContext()); AppDomainSetup domainSetup = new AppDomainSetup(); string name = config.getServletName(); //.getServletContextName(); if (name == null) { name = "GH Application"; } domainSetup.ApplicationName = name; domainSetup.ConfigurationFile = Path.Combine(rootPath, "Web.config"); domainSetup.PrivateBinPath = Path.Combine(rootPath, "WEB-INF/lib"); AppDomain servletDomain = AppDomain.CreateDomain(name, null, domainSetup); //servletDomain.SetData(IAppDomainConfig.APP_PHYS_DIR, J2EEUtils.GetApplicationPhysicalPath(config)); //servletDomain.SetData(IAppDomainConfig.WEB_APP_DIR, rootPath); servletDomain.SetData(IAppDomainConfig.APP_PHYS_DIR, J2EEUtils.GetApplicationPhysicalPath(config.getServletContext())); servletDomain.SetData(IAppDomainConfig.WEB_APP_DIR, rootPath); servletDomain.SetData(IAppDomainConfig.SERVLET_CONFIG, config); //Set DataDirectory substitution string (http://blogs.msdn.com/dataaccess/archive/2005/10/28/486273.aspx) string dataDirectory = config.getServletContext().getInitParameter("DataDirectory"); if (dataDirectory == null) { dataDirectory = "App_Data"; } if (!Path.IsPathRooted(dataDirectory)) { java.io.InputStream inputStream = config.getServletContext().getResourceAsStream("/WEB-INF/classes/appData.properties"); string root; if (inputStream != null) { try { Properties props = new Properties(); props.load(inputStream); root = props.getProperty("root.folder"); } finally { inputStream.close(); } } else { root = config.getServletContext().getRealPath("/"); } if (root == null) { root = String.Empty; } dataDirectory = Path.Combine(root, dataDirectory); } if (dataDirectory [dataDirectory.Length - 1] != Path.DirectorySeparatorChar) { dataDirectory += Path.DirectorySeparatorChar; } servletDomain.SetData("DataDirectory", dataDirectory); if (config.getServletContext().getRealPath("/") == null) { servletDomain.SetData(".appStartTime", DateTime.UtcNow); } // The BaseDir is the full path to the physical dir of the app // and allows the application to modify files in the case of // open deployment. string webApp_baseDir = config.getServletContext().getRealPath(""); if (webApp_baseDir == null || webApp_baseDir == "") { webApp_baseDir = rootPath; } servletDomain.SetData(IAppDomainConfig.APP_BASE_DIR, webApp_baseDir); Debug.WriteLine("Initialization of webapp " + webApp_baseDir); //servletDomain.SetData(".hostingVirtualPath", "/"); //servletDomain.SetData(".hostingInstallDir", "/"); return(servletDomain); }
protected void initImpl(ServletConfig config) { }
/// <summary> /// Called by the servlet container to indicate to a servlet that the /// servlet is being placed into service. /// </summary> public void init(ServletConfig @config) { }
public static void InitRuntime (ServletConfig config, object evidence) { ServletContext context = config.getServletContext (); if (context.getAttribute (J2EEConsts.APP_DOMAIN) != null) return; _facesContextFactory = (FacesContextFactory) FactoryFinder.getFactory (FactoryFinder.FACES_CONTEXT_FACTORY); //TODO: null-check for Weblogic, that tries to initialize Servlet before ContextListener //Javadoc says: Lifecycle instance is shared across multiple simultaneous requests, it must be implemented in a thread-safe manner. //So we can acquire it here once: LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory (FactoryFinder.LIFECYCLE_FACTORY); _lifecycle = lifecycleFactory.getLifecycle (context.getInitParameter (FacesServlet.LIFECYCLE_ID_ATTR) ?? LifecycleFactory.DEFAULT_LIFECYCLE); _renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory (FactoryFinder.RENDER_KIT_FACTORY); AppDomain servletDomain = createServletDomain (config); [email protected] (servletDomain); try { //GH Infromation Initizalization long currentTime = java.lang.System.currentTimeMillis (); servletDomain.SetData (".domainId", currentTime.ToString ("x")); currentTime = ~currentTime; servletDomain.SetData (".appId", currentTime.ToString ("x")); servletDomain.SetData (".appName", servletDomain.SetupInformation.ApplicationName); servletDomain.SetData (J2EEConsts.CLASS_LOADER, java.lang.Thread.currentThread ().getContextClassLoader ()); //servletDomain.SetData (J2EEConsts.CLASS_LOADER, vmw.common.TypeUtils.ToClass (evidence).getClassLoader ()); //servletDomain.SetData(J2EEConsts.SERVLET_CONFIG, config); servletDomain.SetData (J2EEConsts.RESOURCE_LOADER, new ServletResourceLoader (context)); lock (evidence) { if (context.getAttribute (J2EEConsts.APP_DOMAIN) == null) context.setAttribute (J2EEConsts.APP_DOMAIN, servletDomain); } //config.getServletContext ().setAttribute (J2EEConsts.CURRENT_SERVLET, this); } finally { [email protected] (); [email protected] (); } }
override public void init(ServletConfig config) { base.init(config); InitRuntime(config, this); }