/* (non-Javadoc)
@see javax.servlet.Filter#init(javax.servlet.FilterConfig)
495305
@Override
    public void init(FilterConfig filterConfig) throws ServletException {
        super.init(filterConfig);

        int compressionMinSize = readInt(filterConfig.getInitParameter(INIT_PARAM_COMPRESSION_THRESHOLD), this.compressionThreshold);
        long decompressMaxBytesPerSecond = readLong(filterConfig.getInitParameter(INIT_PARAM_DECOMPRESS_MAX_BYTES_PER_SECOND),
                this.decompressionRate);

        long maxDecompressedRequestSize = readLong(filterConfig.getInitParameter(INIT_PARAM_MAX_DECOMPRESSED_REQUEST_SIZE_IN_BYTES),
                this.maxDecompressedRequestSizeInBytes);

        if (compressionMinSize > 0) { // priority given to configured value
            this.compressionThreshold = compressionMinSize;
        }
        if (decompressMaxBytesPerSecond > 0) { // priority given to configured value
            this.decompressionRate = decompressMaxBytesPerSecond;
        }
        if (maxDecompressedRequestSize > 0) { // priority given to configured value
            this.maxDecompressedRequestSizeInBytes = maxDecompressedRequestSize;
        }
        LOGGER.trace("Filter initialized with: {}:{},\n{}:{}\n{}:{}", INIT_PARAM_COMPRESSION_THRESHOLD, String.valueOf(this.compressionThreshold),
                INIT_PARAM_DECOMPRESS_MAX_BYTES_PER_SECOND, String.valueOf(this.decompressionRate),
                INIT_PARAM_MAX_DECOMPRESSED_REQUEST_SIZE_IN_BYTES, String.valueOf(this.maxDecompressedRequestSizeInBytes));
    }
375691
protected void init() {
        for (int i = 0; i < config.getFilter().getInclusions().size(); i++) {
            inclusions.add(Pattern.compile(config.getFilter().getInclusions().get(i)).asPredicate());
        }
        for (int i = 0; i < config.getFilter().getExclusions().size(); i++) {
            exclusions.add(Pattern.compile(config.getFilter().getExclusions().get(i)).asPredicate());
        }
    }
982752
public void init(ServletConfig config) throws ServletException {
        super.init(config);
        mServletConfig = config;
        
        config.getServletContext().log("Initializing TeaServlet...");
        
        String ver = System.getProperty("java.version");
        if (ver.startsWith("0.") || ver.startsWith("1.2") ||
            ver.startsWith("1.3")) {
            config.getServletContext()
                .log("The TeaServlet requires Java 1.4 or higher to run properly");
        }

        mServletContext = setServletContext(config);
        mServletName = setServletName(config);
        
        mProperties = new PropertyMap();
        mSubstitutions = SubstitutionFactory.getDefaults();
        mResourceFactory = 
            new TeaServletResourceFactory(config.getServletContext(), 
                                          mSubstitutions);
        
        Enumeration<?> e = config.getInitParameterNames();
        while (e.hasMoreElements()) {
            String key = (String) e.nextElement();
            String value = 
                SubstitutionFactory.substitute(config.getInitParameter(key));
            
            if (key.equals("debug")) {
                mDebugEnabled = Boolean.parseBoolean(value);
                continue;
            }

            mProperties.put(key, value);
        }

        loadDefaults();
        discoverProperties();
        createListeners();
        createLog(mServletContext);
        mLog.applyProperties(mProperties.subMap("log"));
        createMemoryLog(mLog);
        
        mInstrumentationEnabled = 
            mProperties.getBoolean("instrumentation.enabled", true);
        
        Initializer initializer = new Initializer();
        if (mProperties.getBoolean("startup.background", false)) {
            mInitializer = 
                Executors.newSingleThreadExecutor().submit(initializer);
        }
        else {
            initializer.call();
        }
    }
941842
public void init(FilterConfig filterConfig) throws ServletException {
		// need the Context for Logging, instantiating ClassLoader, etc
		context = filterConfig.getServletContext();
		StringBuilder sb = new StringBuilder();
		StringBuilder err = new StringBuilder(); 
		Object attr = context.getAttribute(Config.PATHFILTER_NS);
		if(attr==null) {
			err.append("PathFilter - pathfilter_ns is not set");
		} else {
			sb.append(attr.toString()); 
		}

		attr = context.getAttribute(Config.PATHFILTER_STACK);
		if(attr==null) {
			log.info("PathFilter - No pathfilter_stack set, ignoring");
		} else {
			sb.append('.');
			sb.append(attr.toString());
		}

		attr = context.getAttribute(Config.PATHFILTER_URLPATTERN);
		if(attr==null) {
			log.info("PathFilter - No pathfilter_urlpattern set, defaulting to 'urlpattern'");
			sb.append(".urlpattern");
		} else {
			sb.append('.');
			sb.append(attr.toString());
		}

		log.info("PathFilter - AAF Permission Type is",sb.toString());
		
		sb.append('|');
		
		aaf_type = sb.toString();

		attr = context.getAttribute(Config.PATHFILTER_NOT_AUTHORIZED_MSG);
		if(attr==null) {
			not_authorized_msg = "Forbidden - Not Authorized to access this Path";
		} else {
			not_authorized_msg = attr.toString();
		}

		if(err.length()>0) {
			throw new ServletException(err.toString());
		}
	}
746349
private void initFilters() {
        ditaWriterFilter = new DitaWriterFilter();
        ditaWriterFilter.setLogger(logger);
        ditaWriterFilter.setJob(job);
        ditaWriterFilter.setEntityResolver(reader.getEntityResolver());

        topicFragmentFilter = new TopicFragmentFilter(ATTRIBUTE_NAME_CONREF, ATTRIBUTE_NAME_CONREFEND);

        tempFileNameScheme.setBaseDir(job.getInputDir());
    }
975509
public synchronized static void initConfig() {
        SeLionLogger.getLogger().entering();
        Map<ConfigProperty, String> initialValues = new HashMap<>();

        initConfig(initialValues);

        SeLionLogger.getLogger().exiting();
    }
1282587
@Override
    public void init(ServletConfig config) throws ServletException {
        m_cache = new HashMap<String, Templates>();
        m_creds = new HashMap<String, UsernamePasswordCredentials>();
        m_cManager = new PoolingClientConnectionManager();
        m_cManager.getSchemeRegistry().register(
                new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
        m_cManager.getSchemeRegistry().register(
                new Scheme("https-tomcat", 8443, SSLSocketFactory.getSocketFactory()));
        m_cManager.getSchemeRegistry().register(
                new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
        m_cManager.getSchemeRegistry().register(
                new Scheme("http-tomcat", 8080, PlainSocketFactory.getSocketFactory()));

        Enumeration<?> enm = config.getInitParameterNames();
        while (enm.hasMoreElements()) {
            String name = (String) enm.nextElement();
            if (name.startsWith(CRED_PARAM_START)) {
                String value = config.getInitParameter(name);
                if (value.indexOf(":") == -1) {
                    throw new ServletException("Malformed credentials for "
                            + name + " -- expected ':' user/pass delimiter");
                }
                String[] parts = value.split(":");
                String user = parts[0];
                StringBuffer pass = new StringBuffer();
                for (int i = 1; i < parts.length; i++) {
                    if (i > 1) {
                        pass.append(':');
                    }
                    pass.append(parts[i]);
                }
                m_creds.put(name.substring(CRED_PARAM_START.length()),
                            new UsernamePasswordCredentials(user, pass
                                    .toString()));
            }
        }
    }
1211144
private static FilterInitializer[] getFilterInitializers(Configuration conf) {
    if (conf == null) {
      return null;
    }

    Class<?>[] classes = conf.getClasses(FILTER_INITIALIZER_PROPERTY);
    if (classes == null) {
      return null;
    }

    FilterInitializer[] initializers = new FilterInitializer[classes.length];
    for(int i = 0; i < classes.length; i++) {
      initializers[i] = (FilterInitializer)ReflectionUtils.newInstance(
          classes[i], conf);
    }
    return initializers;
  }
1051781
@Override
	public void init(ServletConfig servletConfig) throws ServletException {
		final String sourceMethod = "init"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod, new Object[]{servletConfig});
		}
		super.init(servletConfig);

		// Default constructor for MimetypesFileTypeMap *should* read our bundle's
		// META-INF/mime.types automatically, but some older platforms (Domino)
		// don't use the right class loader, so get the input stream ourselves
		// and pass it to the constructor.
		ClassLoader cld = AbstractAggregatorImpl.class.getClassLoader();
		InputStream is = cld.getResourceAsStream("META-INF/mime.types"); //$NON-NLS-1$

		// Initialize the type maps (see getContentType)
		fileTypeMap = new MimetypesFileTypeMap(is);
		fileNameMap = URLConnection.getFileNameMap();

		final ServletContext context = servletConfig.getServletContext();

		// Set servlet context attributes for access though the request
		context.setAttribute(IAggregator.AGGREGATOR_REQATTRNAME, this);
		try {
			webContentUri = AbstractAggregatorImpl.class.getClassLoader().getResource("WebContent").toURI(); //$NON-NLS-1$
		} catch (URISyntaxException e) {
			throw new ServletException(e);
		}

		if (isTraceLogging) {
			log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod);
		}
	}
1332112
public void initConfiguration() throws CmsConfigurationException {

        if ((!TYPE_INCLUDE.equals(m_type)) && (!TYPE_EXCLUDE.equals(m_type))) {
            throw new CmsConfigurationException(Messages.get().container(Messages.ERR_INVALID_FILTER_TYPE_1, m_type));
        }

        if (CmsLog.INIT.isInfoEnabled()) {

            Iterator<Pattern> iter = m_filterRules.iterator();
            while (iter.hasNext()) {
                Pattern rule = iter.next();

                CmsLog.INIT.info(
                    Messages.get().getBundle().key(Messages.INIT_ADD_FILTER_RULE_2, m_type, rule.pattern()));
            }
        }

        m_filterRules = Collections.unmodifiableList(m_filterRules);
    }
80059
@Override
    public void init(FilterConfig filterConfig) {
        String m = "L init() ";
        try {
            logger.debug(m + ">");
            super.init(filterConfig);
            m = FilterSetup.getFilterNameAbbrev(FILTER_NAME) + " init() ";
            inited = false;
            if (!initErrors) {
                Set<String> temp = new HashSet<String>();
                if (ATTRIBUTES2RETURN == null) {
                    ATTRIBUTES2RETURN = EMPTY_STRING_ARRAY;
                } else {
                    for (String element : ATTRIBUTES2RETURN) {
                        temp.add(element);
                    }
                }
                if (AUTHENTICATE && PASSWORD != null && !PASSWORD.isEmpty()) {
                    temp.add(PASSWORD);
                }
                DIRECTORY_ATTRIBUTES_NEEDED =
                        (String[]) temp.toArray(StringArrayPrototype);

                boolean haveBindMethod = false;
                if (SECURITY_AUTHENTICATION != null
                        && !SECURITY_AUTHENTICATION.isEmpty()) {
                    haveBindMethod = true;
                }

                boolean haveSuperUser = false;
                if (SECURITY_PRINCIPAL != null
                        && !SECURITY_PRINCIPAL.isEmpty()) {
                    haveSuperUser = true;
                }

                boolean haveSuperUserPassword = false;
                if (SECURITY_CREDENTIALS != null
                        && !SECURITY_CREDENTIALS.isEmpty()) {
                    haveSuperUserPassword = true;
                }

                if (haveBindMethod && haveSuperUserPassword) {
                    initErrors = !haveSuperUser;
                }

            }
            if (initErrors) {
                logger.error(m + "not initialized; see previous error");
            }
            inited = true;
        } finally {
            logger.debug("{}<", m);
        }
    }
790967
@Override
  public void initialize(URI path, Configuration config) throws IOException {
    initialize(path, config, /* initSuperclass= */ true);
  }
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);
	}
166366
protected void initFilterMapping(XmlParser.Node node)
    {
        String filterName=node.getString("filter-name",false,true);
        String pathSpec=node.getString("url-pattern",false,true);
        String servletName=node.getString("servlet-name",false,true);
        int dispatcher=Dispatcher.__DEFAULT;
        Iterator iter=node.iterator("dispatcher");
        while(iter.hasNext())
        {
            String d=((XmlParser.Node)iter.next()).toString(false,true);
            dispatcher|=Dispatcher.type(d);
        }
            
        FilterHolder holder=(servletName!=null)
                ?getWebApplicationHandler().addFilterServletMapping(servletName, filterName, dispatcher)
                :getWebApplicationHandler().addFilterPathMapping(pathSpec, filterName, dispatcher);
    }
590870
public void init(FilterConfig filterConfig)
        throws ServletException
    {
        _servletContext=filterConfig.getServletContext();
        _unwrappedDispatchSupported=Boolean.valueOf(filterConfig.getInitParameter("unwrappedDispatch")).booleanValue();
    }
534225
@Override
  public void init(PlayerConfig config) throws InitializationFailedException {
    super.init(config);
    solrUrl = config.get(SOLR_URL_KEY);
    if (solrUrl == null || "".equals(solrUrl.trim())) {
      throw new IllegalArgumentException(this.getClass().getName() + " expects configuration property " + SOLR_URL_KEY);
    }
  }
642798
public synchronized void init() {
		for (SocketBinding binding : socketBindings) {
			socketBindingsMap.put(binding.getName(), binding);
		}
		for (SecurityRealm realm : securityRealms) {
			securityRealmsMap.put(realm.getName(), realm);
		}
		for (Interface iface : interfaces) {
			interfacesMap.put(iface.getName(), iface);
		}
		if (subsystem != null) {
			for (UndertowSubsystem.FileHandler handler : subsystem.getFileHandlers()) {
				handlersMap.put(handler.getName(), handler);
			}
			if (subsystem.getFilters() != null) {
				for (UndertowSubsystem.ResponseHeaderFilter filter : subsystem.getFilters().getResponseHeaders()) {
					filtersMap.put(filter.getName(), filter);
				}
				for (UndertowSubsystem.ErrorPageFilter filter : subsystem.getFilters().getErrorPages()) {
					filtersMap.put(filter.getName(), filter);
				}
				for (UndertowSubsystem.CustomFilter filter : subsystem.getFilters().getCustomFilters()) {
					filtersMap.put(filter.getName(), filter);
				}
			}
		}
	}