List of usage examples for javax.servlet FilterConfig getInitParameter
public String getInitParameter(String name);
String
containing the value of the named initialization parameter, or null
if the initialization parameter does not exist. From source file:com.googlecode.jtiger.modules.ecside.filter.ECSideFilter.java
public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; servletContext = filterConfig.getServletContext(); servletRealPath = servletContext.getRealPath("/"); initEncoding();//from w w w. j a v a2 s . co m initProperties(); String responseHeadersSetBeforeDoFilter = filterConfig.getInitParameter("responseHeadersSetBeforeDoFilter"); if (StringUtils.isNotBlank(responseHeadersSetBeforeDoFilter)) { ECSideFilter.responseHeadersSetBeforeDoFilter = Boolean.valueOf(responseHeadersSetBeforeDoFilter) .booleanValue(); } }
From source file:org.ecside.filter.ECSideFilter.java
public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; servletContext = filterConfig.getServletContext(); servletRealPath = servletContext.getRealPath("/"); initEncoding();/* w w w . j a va 2 s . co m*/ initProperties(); String responseHeadersSetBeforeDoFilter = filterConfig .getInitParameter("responseHeadersSetBeforeDoFilter"); if (StringUtils.isNotBlank(responseHeadersSetBeforeDoFilter)) { ECSideFilter.responseHeadersSetBeforeDoFilter = Boolean.valueOf( responseHeadersSetBeforeDoFilter).booleanValue(); } }
From source file:org.bonitasoft.console.common.server.login.filter.AuthenticationFilter.java
/** * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) *//*from w w w .j ava2 s .c o m*/ @Override public void init(final FilterConfig filterConfig) throws ServletException { final String contextPath = filterConfig.getServletContext().getContextPath(); String webappName; if (contextPath.length() > 0) { webappName = contextPath.substring(1); } else { webappName = ""; } excludePattern = compilePattern(StringUtils.isBlank(filterConfig.getInitParameter("excludePattern")) ? getDefaultExcludedPages().replace("bonita", webappName) : filterConfig.getInitParameter("excludePattern")); }
From source file:com.avlesh.web.filter.responseheaderfilter.ResponseHeaderManagerFilter.java
public void init(FilterConfig filterConfig) throws ServletException, RuntimeException { filterConfigObj = filterConfig;//w ww . j av a 2s. c o m //if specified in web.xml, take that value as the config file String fullConfigFilePath; // only expand the path with the realpath if not defined if (StringUtils.isNotEmpty(filterConfig.getInitParameter("configFile"))) { fullConfigFilePath = filterConfig.getInitParameter("configFile"); } else { fullConfigFilePath = filterConfig.getServletContext().getRealPath(configFileName); } configFile = new File(fullConfigFilePath); if (!configFile.exists() || !configFile.canRead()) { //not expecting this, the config file should exist and be readable throw new RuntimeException( "Cannot initialize ResponseHeaderManagerFilter, error reading " + configFileName); } //object to hold preferences related to conf reloading confReloadInfo = new ConfReloadInfo(); String reloadCheckIntervalStr = filterConfig.getInitParameter("reloadCheckInterval"); //if web.xml filter definition has no "reloadCheckInterval" applied, default values in ConfReloadInfo are used if (StringUtils.isNotEmpty(reloadCheckIntervalStr)) { Integer reloadCheckInterval = Integer.valueOf(reloadCheckIntervalStr); if (reloadCheckInterval > 0) { confReloadInfo.reloadEnabled = true; confReloadInfo.reloadCheckInterval = reloadCheckInterval; } else { //zero or negative values means don't ever reload confReloadInfo.reloadEnabled = false; confReloadInfo.reloadCheckInterval = 0; } } //parse all the mappings into Rules ConfigProcessor configProcessor = new ConfigProcessor(configFile); Map<Pattern, Rule> allRules = configProcessor.getRuleMap(); urlPatterns.addAll(allRules.keySet()); rules.putAll(allRules); }
From source file:org.primefaces.webapp.filter.FileUploadFilter.java
public void init(FilterConfig filterConfig) throws ServletException { boolean isAtLeastJSF22 = detectJSF22(); String uploader = filterConfig.getServletContext().getInitParameter(Constants.ContextParams.UPLOADER); if (uploader == null || uploader.equals("auto")) { bypass = isAtLeastJSF22 ? true : false; } else if (uploader.equals("native")) { bypass = true;/* w ww. jav a 2 s .c o m*/ } else if (uploader.equals("commons")) { bypass = false; } thresholdSize = filterConfig.getInitParameter(THRESHOLD_SIZE_PARAM); uploadDir = filterConfig.getInitParameter(UPLOAD_DIRECTORY_PARAM); if (logger.isLoggable(Level.FINE)) { logger.fine("FileUploadFilter initiated successfully"); } }
From source file:eionet.cr.web.action.admin.staging.AvailableFilesActionBean.java
/** * Initializations and other pre-actions that should be invoked prior to {@link LifecycleStage.BindingAndValidation}. *///from w ww . j ava 2 s . co m @Before(stages = { LifecycleStage.BindingAndValidation }) public void beforeBindingAndValidation() { FilterConfig stripesFilterConfig = StripesFilter.getConfiguration().getBootstrapPropertyResolver() .getFilterConfig(); maxFilePostSize = NumberUtils.toInt(stripesFilterConfig.getInitParameter("FileUpload.MaximumPostSize")); }
From source file:org.withinsea.izayoi.adapter.springmvc.SpringIzayoiDispatcherFilter.java
@Override public void init(final FilterConfig filterConfig) throws ServletException { cloister = new Cloister(); glowworm = new Glowworm(); cortile = new Cortile(); izayoiInterceptor = new SpringGlowwormInterceptor(glowworm); izayoiViewResolver = new SpringCloisterCortileViewResolver(cortile, cloister); super.init(new ServletConfig() { @Override//from www .j a v a 2 s . c om public String getInitParameter(String s) { return filterConfig.getInitParameter(s); } @Override public String getServletName() { return filterConfig.getFilterName(); } @Override public ServletContext getServletContext() { return filterConfig.getServletContext(); } @Override @SuppressWarnings("unchecked") public Enumeration<String> getInitParameterNames() { return filterConfig.getInitParameterNames(); } }); ApplicationContext appctx = getWebApplicationContext(); ServletContext servletContext = filterConfig.getServletContext(); Map<String, String> overriddenProperties = ServletFilterUtils.getParamsMap(filterConfig); IzayoiContainer container = new IzayoiContainerFactory().addBeanSource(new SpringBeanSource(appctx)) .addModule("org.withinsea.izayoi.core").addModule("org.withinsea.izayoi.cloister") .addModule("org.withinsea.izayoi.glowworm").addModule("org.withinsea.izayoi.cortile") .addModule("org.withinsea.izayoi.adapter.springmvc").create(servletContext, overriddenProperties); cloister.init(container); glowworm.init(container); cortile.init(container); }
From source file:org.xmlactions.web.conceal.HttpPager.java
/** * @see Servlet#init(ServletConfig)/*from ww w .j a va 2 s . co m*/ */ public void init(FilterConfig filterConfig) { String value; value = filterConfig.getInitParameter("pager.realPath"); if (StringUtils.isEmpty(value)) { value = filterConfig.getServletContext().getRealPath(""); } if (StringUtils.isNotEmpty(value)) { realPath = value; } value = filterConfig.getInitParameter("pager.namespace"); if (StringUtils.isNotEmpty(value)) { nameSpace = value; } value = filterConfig.getInitParameter("pager.wrapperPage"); if (StringUtils.isNotEmpty(value)) { wrapperPage = value; } value = filterConfig.getInitParameter("pager.pre.page"); if (StringUtils.isNotEmpty(value)) { prePage = value; } value = filterConfig.getInitParameter("pager.post.page"); if (StringUtils.isNotEmpty(value)) { postPage = value; } }
From source file:net.geant.edugain.filter.EduGAINFilter.java
private void loadConfiguration(FilterConfig config) { String nonDefaultConfig = (String) config.getInitParameter("eduGAINConfig"); if (nonDefaultConfig != null) { this.config = Configurator.getInstance(nonDefaultConfig); } else/* ww w.ja v a2s . co m*/ this.config = Configurator.getInstance(); this.serviceID = (String) this.config.getProperty("net.geant.edugain.filter.serviceID"); }