This method is called automatically when the servlet is initializing.
325368
@Override
	public void initialize() {
		final List<IResourceProvider> providers = new ArrayList<IResourceProvider>();
		providers.add(new SomeResourceProvider());
		setResourceProviders(providers);


		registerInterceptor(new ResponseHighlighterInterceptor());

	}
896067
public void init(ServletConfig config) throws ServletException
    {
        super.init(config);
        ServletTask.initServlet(this, BasicServlet.SERVLET_TYPE.PROXY);
        
        m_servletTask = this.createProxyTask();
    }
92872
@Override
   protected void initialize() throws ServletException {
      /*
       * The servlet defines any number of resource providers, and
       * configures itself to use them by calling
       * setResourceProviders()
       */
      List<IResourceProvider> resourceProviders = new ArrayList<IResourceProvider>();
      resourceProviders.add(new RestfulPatientResourceProvider());
      resourceProviders.add(new RestfulObservationResourceProvider());
      setResourceProviders(resourceProviders);
   }
612387
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);
		for (int i = 0; i < AUDIO_FILES.length; i++) {
			String audioFile = AUDIO_FILES[i];
			logger.info("Writing " + audioFile + " to webapp temp dir : "
					+ tempWriteDir);			
			InputStream is = servletContext.getResourceAsStream(AUDIO_DIR + "/" + audioFile);
			copyToTempDir(is, tempWriteDir, audioFile);
		} 

		Enumeration<String> initParamNames = servletContext
				.getInitParameterNames();
		logger.info("Setting init Params into application context");
		while (initParamNames.hasMoreElements()) {
			String initParamName = (String) initParamNames.nextElement();
			servletContext.setAttribute(initParamName, servletContext
					.getInitParameter(initParamName));
			logger.info("Param key=" + initParamName + ", value = "
					+ servletContext.getInitParameter(initParamName));
		}
		// map acting as a registrar
		servletContext.setAttribute("registeredUsersMap", new HashMap<String, String>());
		
		if(servletContextEvent.getServletContext().getAttribute(MS_CONTROL_FACTORY) == null) {
			DriverImpl d = new DriverImpl();
			properties = new Properties();
			properties.setProperty(MGCP_STACK_NAME, "SipServlets");
			properties.setProperty(MGCP_PEER_IP, PEER_ADDRESS);
			properties.setProperty(MGCP_PEER_PORT, MGW_PORT);
	
			properties.setProperty(MGCP_STACK_IP, LOCAL_ADDRESS);
			properties.setProperty(MGCP_STACK_PORT, CA_PORT);
	
			try {
				// create the Media Session Factory
				final MsControlFactory msControlFactory = new DriverImpl().getFactory(properties); 
				MsControlObjects.msControlFactory = msControlFactory;
				servletContextEvent.getServletContext().setAttribute(MS_CONTROL_FACTORY, msControlFactory);
				
				MMSUtil.msControlFactory = MsControlObjects.msControlFactory;
				String pathToAudioDirectory = (String)servletContextEvent.getServletContext().getAttribute("audioFilePath");
				MMSUtil.audioFilePath = pathToAudioDirectory;
				logger.info("started MGCP Stack on " + LOCAL_ADDRESS + "and port " + CA_PORT + " obj: " + MsControlObjects.msControlFactory);
			} catch (Exception e) {
				logger.error("couldn't start the underlying MGCP Stack", e);
			}
		} else {
			logger.info("MGCP Stack already started on " + LOCAL_ADDRESS + "and port " + CA_PORT);
		}
	}
650438
public static void initServletRequest(ServletRequest servletRequest, TemplatedURLFormatter formatter)
    {
        assert servletRequest != null : "The ServletRequest cannot be null.";

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

        servletRequest.setAttribute(TEMPLATED_URL_FORMATTER_ATTR, formatter);
    }
474242
public void init(ServletConfig config)
        throws ServletException
    {
        super.init(config);

        try {
            if (_homeImpl != null) {
            }
            else if (getInitParameter("home-class") != null) {
                String className = getInitParameter("home-class");

                Class<?> homeClass = loadClass(className);

                _homeImpl = homeClass.newInstance();

                init(_homeImpl);
            }
            else if (getInitParameter("service-class") != null) {
                String className = getInitParameter("service-class");

                Class<?> homeClass = loadClass(className);

                _homeImpl = homeClass.newInstance();

                init(_homeImpl);
            }
            else {
                if (getClass().equals(HessianServlet.class))
                    throw new ServletException("server must extend HessianServlet");

                _homeImpl = this;
            }

            if (_homeAPI != null) {
            }
            else if (getInitParameter("home-api") != null) {
                String className = getInitParameter("home-api");

                _homeAPI = loadClass(className);
            }
            else if (getInitParameter("api-class") != null) {
                String className = getInitParameter("api-class");

                _homeAPI = loadClass(className);
            }
            else if (_homeImpl != null) {
                _homeAPI = findRemoteAPI(_homeImpl.getClass());

                if (_homeAPI == null)
                    _homeAPI = _homeImpl.getClass();

                _homeAPI = _homeImpl.getClass();
            }

            if (_objectImpl != null) {
            }
            else if (getInitParameter("object-class") != null) {
                String className = getInitParameter("object-class");

                Class<?> objectClass = loadClass(className);

                _objectImpl = objectClass.newInstance();

                init(_objectImpl);
            }

            if (_objectAPI != null) {
            }
            else if (getInitParameter("object-api") != null) {
                String className = getInitParameter("object-api");

                _objectAPI = loadClass(className);
            }
            else if (_objectImpl != null)
                _objectAPI = _objectImpl.getClass();

            _homeSkeleton = new HessianSkeleton(_homeImpl, _homeAPI);

            if (_objectAPI != null)
                _homeSkeleton.setObjectClass(_objectAPI);

            if (_objectImpl != null) {
                _objectSkeleton = new HessianSkeleton(_objectImpl, _objectAPI);
                _objectSkeleton.setHomeClass(_homeAPI);
            }
            else
                _objectSkeleton = _homeSkeleton;

            if ("true".equals(getInitParameter("debug"))) {
            }

            if ("false".equals(getInitParameter("send-collection-type")))
                setSendCollectionType(false);
        } catch (ServletException e) {
            throw e;
        } catch (Exception e) {
            throw new ServletException(e);
        }
    }
866773
@Override
	public void contextInitialized(ServletContextEvent evt) {
		ServletContext sc = evt.getServletContext();

		// Initialize Jawr JS servlet
		ServletRegistration.Dynamic sr = sc.addServlet("JavascriptServlet",
				"net.jawr.web.servlet.JawrServlet");
		sr.setInitParameter("configLocation", "/jawr.properties");
		sr.addMapping("*.js");
		sr.setLoadOnStartup(0);

		// Initialize Jawr CSS servlet
		sr = sc.addServlet("CssServlet", "net.jawr.web.servlet.JawrServlet");
		sr.setInitParameter("configLocation", "/jawr.properties");
		sr.setInitParameter("type", JawrConstant.CSS_TYPE);
		sr.addMapping("*.css");
		sr.setLoadOnStartup(1);

		// Initialize Jawr Binary servlet
		sr = sc.addServlet("BinaryServlet", "net.jawr.web.servlet.JawrServlet");
		sr.setInitParameter("configLocation", "/jawr.properties");
		sr.setInitParameter("type", JawrConstant.BINARY_TYPE);
		sr.addMapping("*.jpg", "*.png", "*.gif", "*.woff", "*.ttf", "*.svg", "*.eot");
		sr.setLoadOnStartup(0);
	}
993715
@Override
  public void contextInitialized(ServletContextEvent event) {
    this.event = event;
    this.serverContainer = getServerContainer(event);
    super.contextInitialized(event);
  }
775482
@Override
    public void contextInitialized(ServletContextEvent contextEvent) {
        configSupport = new ServletContexConfigSupport();
        if (configSupport.hasHandlers(contextEvent.getServletContext())) {
            AuditManager.startWithConfiguration(configSupport.loadConfig(contextEvent.getServletContext()));
        } else {
            AuditManager.getInstance();
        }
    }
527326
public void init(ServletConfig config) throws ServletException {
        /*
         * Never forget super.init()!
         */
        super.init(config);

        /*
         * Grab the servlet context.
         */
        this.servletContext = config.getServletContext();

        // Get verbosity hint.
        String value = config.getInitParameter("verbose");
        if (value != null) {
            this.verbose = Boolean.valueOf(value);
        }

        // get encoding
        value = config.getInitParameter("encoding");
        if (value != null) {
            this.encoding = value;
        }

        // And now the real init work...
        if (verbose) {
            log("Parsing init parameters...");
        }

        String regex = config.getInitParameter(INIT_PARAM_RESOURCE_NAME_REGEX);
        if (regex != null) {
            String replacement = config.getInitParameter("resource.name.replacement");
            if (replacement == null) {
                Exception npex = new NullPointerException("resource.name.replacement");
                String message = "Init-param 'resource.name.replacement' not specified!";
                log(message, npex);
                throw new ServletException(message, npex);
            } else if ("EMPTY_STRING".equals(replacement)) {//<param-value></param-value> is prohibited
                replacement = "";
            }
            int flags = 0; // TODO : Parse pattern compile flags (literal names).
            String flagsStr = config.getInitParameter(INIT_PARAM_RESOURCE_NAME_REGEX_FLAGS);
            if (flagsStr != null && flagsStr.length() > 0) {
              flags = Integer.decode(flagsStr.trim());//throws NumberFormatException
            }
            resourceNamePattern = Pattern.compile(regex, flags);
            this.resourceNameReplacement = replacement;
            String all = config.getInitParameter("resource.name.replace.all");
            if (all != null) {
                this.resourceNameReplaceAll = Boolean.valueOf(all.trim());
            }
        }

        value = config.getInitParameter("logGROOVY861");
        if (value != null) {
            this.logGROOVY861 = Boolean.valueOf(value);
            // nothing else to do here
        }

        /*
         * If verbose, log the parameter values.
         */
        if (verbose) {
            log("(Abstract) init done. Listing some parameter name/value pairs:");
            log("verbose = " + verbose); // this *is* verbose! ;)
            log("reflection = " + reflection);
            log("logGROOVY861 = " + logGROOVY861);
            log(INIT_PARAM_RESOURCE_NAME_REGEX + " = " + resourceNamePattern);//toString == pattern
            log("resource.name.replacement = " + resourceNameReplacement);
        }
    }
1186880
@Override
    public void init() throws ServletException {
        super.init();

        // GET
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
            Operation.list, new ListOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.tree, new TreeOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.query, new QueryOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.filterList, new ListFiltersOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.coverage, new CoverageOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.zip,
                Operation.download, new DownloadOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.html,
                Operation.download, new DownloadOperation());

        // POST
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.service, new ServiceOperation());

        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.create, new CreateOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.update, new UpdateOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.upload, new UploadOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.install, new InstallOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
            Operation.uninstall, new UninstallOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.deploy, new ServiceOperation());

        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterChange, new ChangeFilterOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterAdd, new AddFilterOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterRemove, new RemoveFilterOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterMoveUp, new MoveFilterOperation(true));
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterMoveDown, new MoveFilterOperation(false));

        // PUT
        operations.setOperation(ServletOperationSet.Method.PUT, Extension.json,
                Operation.update, new JsonUpdateOperation());

        // DELETE
        operations.setOperation(ServletOperationSet.Method.DELETE, Extension.json,
                Operation.delete, new DeleteOperation());
    }
1041449
@Override
  public void onStartup(Set<Class<?>> set, ServletContext servletContext) throws ServletException {
    final ClassLoaderLeakPreventorListener classLoaderLeakPreventorListener = new ClassLoaderLeakPreventorListener();
    try {
      classLoaderLeakPreventorListener.contextInitialized(servletContext); // Initialize immediately

      servletContext.addListener(new ServletContextListener() {
        @Override
        public void contextInitialized(ServletContextEvent servletContextEvent) {
          // Do nothing, already done above
        }

        @Override
        public void contextDestroyed(ServletContextEvent servletContextEvent) {
          classLoaderLeakPreventorListener.contextDestroyed(servletContextEvent);
        }
      });
    }
    catch (Throwable t) { // (Shouldn't really be needed)
      t.printStackTrace(System.err);
    }

    for(ServletContextListener otherListener : ClassLoaderLeakPreventorListener.getDefaultOtherListeners()) {
      servletContext.addListener(otherListener);
    }
  }
838788
public void initializeServlets()
        throws Exception
    {
        MultiException mx = new MultiException();
        
        // Sort and Initialize servlets
        ServletHolder[] holders = getServlets();
        for (int i=0; i<holders.length; i++)
        {
            try{holders[i].start();}
            catch(Exception e)
            {
                log.debug(LogSupport.EXCEPTION,e);
                mx.add(e);
            }
        } 
        mx.ifExceptionThrow();       
    }
739012
@PostConstruct
    public synchronized void initialize() {
        final FwWebDirection direction = assistWebDirection();
        final SessionResourceProvider provider = direction.assistSessionResourceProvider();
        sessionSharedStorage = prepareSessionSharedStorage(provider);
        httpSessionArranger = prepareHttpSessionArranger(provider);
        showBootLogging();
    }
822959
public static synchronized void init() {
        if (initialized)
            return;
        if (tc.isEntryEnabled()) {
            Tr.entry(tc, "init");
        }

        initialized = true;
        //defaultLevel = StatConstants.STATISTIC_SET_EXTENDED;
        defaultLevel = StatConstants.STATISTIC_SET_BASIC;
        moduleRoot = new ModuleItem();
        setInstrumentationLevel(defaultLevel);
        //disabled = false;
        try {
            MBeanServer mServer = ManagementFactory.getPlatformMBeanServer();
            ObjectName pmiMBean = new ObjectName(PmiConstants.MBEAN_NAME);
            mServer.registerMBean(PmiCollaboratorFactory.getPmiCollaborator(), pmiMBean);
            printAllMBeans();
        } catch (Exception e) {
            Tr.error(tc, "Unable to create Perf MBean.");
            FFDCFilter.processException(e, "com.ibm.ws.pmi.server.PmiRegistry", "Init");
        }
        if (tc.isEntryEnabled()) {
            Tr.exit(tc, "init");
        }
    }
1331436
@Override
    protected void initFilterBean() throws ServletException {
        if (this.resourcesElementsProvider == null) {
            final ServletContext servletContext = this.getServletContext();
            this.resourcesElementsProvider = ResourcesElementsProviderUtils.getOrCreateResourcesElementsProvider(servletContext);
        }
    }
862076
@Override
    public void contextInitialized(ServletContextEvent event) {
        _registry.put(INSTANCE, new Pair<Service, Persistence>(this, null));

        _context = event.getServletContext();
        _application = _context.getContextPath();
        _logger.config("application: " + _application);
        if (_application.charAt(0) == '/') _application = _application.substring(1);

        try { ManagementFactory.getPlatformMBeanServer().setAttribute(
            new ObjectName("Catalina:host=localhost,name=AccessLogValve,type=Valve"), new Attribute("condition", "intrinsic")
        ); } catch (Exception x) {}
    }