Things won't ever be modified when loaded from the servlet context
because they came from the webapp .war file and if that is reloaded,
everything will be thrown away and started afresh.
355627
@Override
    public boolean isSourceModified (Resource resource)
    {
        SiteKey skey = new SiteKey(resource.getName());

        // if the resource is for the default site, it is never considered to
        // be modified
        if (skey.siteId == SiteIdentifier.DEFAULT_SITE_ID) {
            return false;

        } else {
            // otherwise compare the last modified time of the loaded resource
            // with that of the associated site-specific jar file
            try {
                return (resource.getLastModified() <
                        _loader.getLastModified(skey.siteId));
            } catch (IOException ioe) {
                Log.log.warning("Failure obtaining last modified time of site-specific jar file",
                                "siteId", skey.siteId, "error", ioe);
                return false;
            }
        }
    }
1158300
public boolean changeServletProperties(Servlet servlet, Dictionary<String, String> properties)
    {
        if (servlet instanceof WebappServlet)
        {
            Dictionary<String, String> dictionary = ((WebappServlet)servlet).getProperties();
            properties = BaseBundleActivator.putAll(properties, dictionary);
        }
        return this.setServletProperties(servlet, properties);
    }
1045440
private void initContainerSpecifics(ServletContext context) {

        // the tags behavior
        m_releaseTagsAfterEnd = !(m_servletContainerName.indexOf(SERVLET_CONTAINER_RESIN) > -1);

        // the request error page attribute
        if (m_servletContainerName.indexOf(SERVLET_CONTAINER_WEBLOGIC) > -1) {
            m_requestErrorPageAttribute = REQUEST_ERROR_PAGE_ATTRIBUTE_WEBLOGIC;
        }

        // the failed initialization behavior
        m_servletThrowsException = true;
        m_servletThrowsException &= (m_servletContainerName.indexOf(SERVLET_CONTAINER_RESIN) < 0);
        m_servletThrowsException &= (m_servletContainerName.indexOf(SERVLET_CONTAINER_WEBLOGIC) < 0);
        m_servletThrowsException &= (m_servletContainerName.indexOf(SERVLET_CONTAINER_GLASSFISH) < 0);

        // the flush flex response behavior
        m_preventResponseFlush = false;
        m_preventResponseFlush |= (m_servletContainerName.indexOf(SERVLET_CONTAINER_WEBSPHERE) > -1);
        m_preventResponseFlush |= (m_servletContainerName.indexOf(SERVLET_CONTAINER_RESIN) > -1);
    }
1296870
@Override
    public void init() throws ServletException {

        if (LOG.isInfoEnabled()) {
            LOG.info(Messages.get().getBundle().key(Messages.LOG_INIT_WEBDAV_SERVLET_0));
        }

        String value = null;

        // init parameter: listings
        try {
            value = getServletConfig().getInitParameter(INIT_PARAM_LIST);
            if (value != null) {
                m_listings = Boolean.valueOf(value).booleanValue();
            }
        } catch (Exception e) {
            if (LOG.isErrorEnabled()) {
                LOG.error(
                    Messages.get().getBundle().key(Messages.LOG_READ_INIT_PARAM_ERROR_2, INIT_PARAM_LIST, value),
                    e);
            }
        }

        if (LOG.isInfoEnabled()) {
            LOG.info(
                Messages.get().getBundle().key(
                    Messages.LOG_READ_INIT_PARAM_2,
                    INIT_PARAM_LIST,
                    Boolean.valueOf(m_listings)));
        }

        // init parameter: read only
        try {
            value = getServletConfig().getInitParameter(INIT_PARAM_READONLY);
            if (value != null) {
                m_readOnly = Boolean.valueOf(value).booleanValue();
            }
        } catch (Exception e) {
            if (LOG.isErrorEnabled()) {
                LOG.error(
                    Messages.get().getBundle().key(Messages.LOG_READ_INIT_PARAM_ERROR_2, INIT_PARAM_READONLY, value),
                    e);
            }
        }

        if (LOG.isInfoEnabled()) {
            LOG.info(
                Messages.get().getBundle().key(
                    Messages.LOG_READ_INIT_PARAM_2,
                    INIT_PARAM_READONLY,
                    Boolean.valueOf(m_readOnly)));
        }

        // Load the MD5 helper used to calculate signatures.
        try {
            m_md5Helper = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {

            if (LOG.isErrorEnabled()) {
                LOG.error(Messages.get().getBundle().key(Messages.ERR_MD5_NOT_AVAILABLE_0), e);
            }

            throw new UnavailableException(Messages.get().getBundle().key(Messages.ERR_MD5_NOT_AVAILABLE_0));
        }

        // Instantiate repository from init-param
        String repositoryName = getInitParameter(INIT_PARAM_REPOSITORY);
        if (repositoryName == null) {

            if (LOG.isErrorEnabled()) {
                LOG.error(Messages.get().getBundle().key(Messages.ERR_INIT_PARAM_MISSING_1, INIT_PARAM_REPOSITORY));
            }

            throw new ServletException(
                Messages.get().getBundle().key(Messages.ERR_INIT_PARAM_MISSING_1, INIT_PARAM_REPOSITORY));
        }

        m_repository = OpenCms.getRepositoryManager().getRepository(repositoryName, A_CmsRepository.class);
        if (m_repository == null) {

            if (LOG.isErrorEnabled()) {
                LOG.error(Messages.get().getBundle().key(Messages.ERR_REPOSITORY_NOT_FOUND_1, repositoryName));
            }

            throw new ServletException(
                Messages.get().getBundle().key(Messages.ERR_REPOSITORY_NOT_FOUND_1, repositoryName));
        }

        if (LOG.isInfoEnabled()) {
            LOG.info(Messages.get().getBundle().key(Messages.LOG_USE_REPOSITORY_1, repositoryName));
        }
    }
862132
@RequirePOST
    public void doDownload(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException {
        doGenerateAllBundles(req, rsp);
    }
559817
private boolean removeUpdate() throws IOException, ServletException {
	final File patchDir = getPatchDirectory();
	final File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { "rc", "rcs" }));

	for (int i = 0; i < patches.length; i++)
	    if (!patches[i].delete()) patches[i].deleteOnExit();
	_restart();
	return true;
    }
1329040
public void initialize() throws ServletException, Throwable {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
            logger.entering(CLASS_NAME, "Initialize : app = " + config.getApplicationName() + ", initialized = " + initialized + ", destroyed = " + destroyed);
        
        if (!initialized && !destroyed) {
            synchronized (lock) {
                if (!initialized && !destroyed &&!com.ibm.ws.webcontainer.osgi.WebContainer.isServerStopping()) {
                    initialize(this.config, this.moduleConfig, this.extensionFactories);
                    started();
                    initialized = true;
                    config.setSessionCookieConfigInitilialized();
                }
            }
        }
               
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
            logger.exiting(CLASS_NAME, "Initialize : initialized = " + initialized + ", destroyed = " + destroyed);

    }
1251725
@Override
    public void init() throws ServletException {
        super.init();

        // GET
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.get, new GetOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.map, new MapGetOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.bin,
                Operation.get, new GetBinaryOperation());

        // POST
        operations.setOperation(ServletOperationSet.Method.POST, Extension.bin,
                Operation.put, new PostBinaryOperation());

        // PUT
        operations.setOperation(ServletOperationSet.Method.PUT, Extension.json,
                Operation.put, new PutOperation());
        operations.setOperation(ServletOperationSet.Method.PUT, Extension.json,
                Operation.copy, new CopyOperation());
        operations.setOperation(ServletOperationSet.Method.PUT, Extension.bin,
                Operation.put, new PutBinaryOperation());
        operations.setOperation(ServletOperationSet.Method.PUT, Extension.bin,
                Operation.update, new PutUpdateOperation());

        // DELETE
        operations.setOperation(ServletOperationSet.Method.DELETE, Extension.json,
                Operation.remove, new RemoveOperation());
    }
1340133
public void init() throws ServletException {
        _application = ((ManagedPlatform)ServicePlatform.getService(ManagedPlatform.INSTANCE).first).getName();

/*
        ApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
        if (wac.containsBean("persistence")) { // persistence may not be there if persistent storage is not required
            _persistence = (Persistence)wac.getBean("persistence");
        }
*/
    }
920875
@Override
	public void registerServlet(Class<? extends Servlet> servletClass,
								String[] urlPatterns, Dictionary<String, ?> initParams,
								HttpContext httpContext) throws ServletException {
		LOG.warn("Http service has already been stopped");
	}
140697
protected static void init(ServletContext context) {
		TimeInterval interval = new TimeInterval();
		
		servletContext = context;
		contextPath = context.getContextPath();
		handler = new ActionHandler(HuluSetting.actionPackages);
		
		String startMsg = null;
		try {
			startMsg = FileUtil.readUtf8String("startup.txt");
		} catch (IORuntimeException e) {
			Throwable cause = e.getCause();
			if(null != cause){
				if(cause instanceof FileNotFoundException){
					log.debug("No file [startup.txt] in classpath, use default start messsage.");
				}else{
					log.warn("Read [startup.txt] error, cause by: {}", cause.getMessage());
				}
			}else{
				log.warn("Read [startup.txt] error, cause by: {}", e.getMessage());
			}
		}
		
		if(StrUtil.isNotBlank(startMsg)){
			Dict param = Dict.create().set("spend", interval.intervalMs()).set("contextPath", contextPath);
			log.info(StrUtil.format("\n" + startMsg, param));
		}else{
			log.info("\n***** Hulu framwork init finished, context path: [{}], spend {}ms *****", contextPath, interval.intervalMs());
		}
	}
690450
public static void initServletRequest(ServletRequest servletRequest, URLTemplatesFactory templatesFactory)
    {
        assert servletRequest != null : "The ServletRequest cannot be null.";

        if (servletRequest == null) {
            throw new IllegalArgumentException("The ServletRequest cannot be null.");
        }

        servletRequest.setAttribute(URL_TEMPLATE_FACTORY_ATTR, templatesFactory);
    }
638339
public void configureWebApp() throws Exception
    {
        //cannot configure if the context is already started
        if (_context.isStarted())
        {
            if (log.isDebugEnabled()){log.debug("Cannot configure webapp after it is started");};
            return;
        }
        
        Resource webInf=getWebApplicationContext().getWebInf();
        // handle any WEB-INF descriptors
        if(webInf!=null&&webInf.isDirectory())
        {
            // do web.xml file
            Resource web=webInf.addPath("web.xml");
            if(!web.exists())
            {
                log.info("No WEB-INF/web.xml in "+getWebApplicationContext().getWAR()
                        +". Serving files and default/dynamic servlets only");
            }
            else
            {
                XmlParser.Node config=null;
                config=xmlParser.parse(web.getURL());
                initialize(config);
            }
        }
    }
1097856
@Override
    public void init(final ServletConfig config) throws ServletException {
        super.init(config);
        contextDirPath = getServletContext().getRealPath("/");

    }
232881
public void restartWebApplication(DeployedModule webModuleConfig) throws WebAppNotLoadedException {
        try {
            removeWebApplication(webModuleConfig);
        } catch (Exception e) {
            String groupName = webModuleConfig.getName();
            //Translated to SRVE0314E: Failed to remove web module {0}: {1}
            String message = nls.getFormattedMessage("failed.to.remove.webmodule", new Object[] { groupName, e }, "Failed to remove web module");
            logger.logp(Level.SEVERE, CLASS_NAME, "restartWebApplication", message);
            return;
        }

        addWebApplication(webModuleConfig);
    }
1085140
@Override public void init(ServletConfig config) throws ServletException{
		super.init(config);
		
		getStats          = new ServletStats("get", getMonitoringIntervals());
		postStats         = new ServletStats("post", getMonitoringIntervals());
		putStats          = new ServletStats("put", getMonitoringIntervals());
		headStats         = new ServletStats("head", getMonitoringIntervals());
		optionsStats      = new ServletStats("options", getMonitoringIntervals());
		traceStats        = new ServletStats("trace", getMonitoringIntervals());
		deleteStats       = new ServletStats("delete", getMonitoringIntervals());
		lastModifiedStats = new ServletStats("lastModified", getMonitoringIntervals());
		
		cachedStatList = new ArrayList<IStats>(useShortStatList()? 2 : 8);
		cachedStatList.add(getStats);
		cachedStatList.add(postStats);
		if (!useShortStatList()){
			cachedStatList.add(deleteStats);
			cachedStatList.add(headStats);
			cachedStatList.add(optionsStats);
			cachedStatList.add(putStats);
			cachedStatList.add(traceStats);
			cachedStatList.add(lastModifiedStats);
		}

		ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this);
	}
454766
public void contextInitialized(ServletContextEvent servletContextEvent) {
		ServletContext servletContext = servletContextEvent.getServletContext();

		File tempWriteDir = (File) servletContext
				.getAttribute("javax.servlet.context.tempdir");
		servletContext.setAttribute("audioFilePath", FILE_PROTOCOL + tempWriteDir
				.getAbsolutePath() + File.separatorChar);		
		// map acting as a registrar
		servletContext.setAttribute("registeredUsersMap", new HashMap<String, String>());
	}