List of usage examples for javax.servlet FilterConfig getServletContext
public ServletContext getServletContext();
From source file:org.josso.servlet.agent.GenericServletSSOAgentFilter.java
public void init(FilterConfig filterConfig) throws ServletException { // Validate and update our current component state ServletContext ctx = filterConfig.getServletContext(); ctx.setAttribute(KEY_SESSION_MAP, new HashMap()); if (_agent == null) { try {/* ww w . ja v a 2 s . c o m*/ Lookup lookup = Lookup.getInstance(); lookup.init("josso-agent-config.xml"); // For spring compatibility ... // We need at least an abstract SSO Agent _agent = (HttpSSOAgent) lookup.lookupSSOAgent(); if (log.isDebugEnabled()) _agent.setDebug(1); _agent.start(); // Publish agent in servlet context filterConfig.getServletContext().setAttribute("org.josso.agent", _agent); } catch (Exception e) { throw new ServletException("Error starting SSO Agent : " + e.getMessage(), e); } } }
From source file:org.josso.wls10.agent.WLSAgentServletFilter.java
public void init(FilterConfig filterConfig) throws ServletException { // Validate and update our current component state ServletContext ctx = filterConfig.getServletContext(); ctx.setAttribute(KEY_SESSION_MAP, new HashMap()); if (_agent == null) { try {/*from w w w . ja v a 2 s . c o m*/ Lookup lookup = Lookup.getInstance(); lookup.init("josso-agent-config.xml"); // For spring compatibility ... // We need at least an abstract SSO Agent _agent = (WLSSSOAgent) lookup.lookupSSOAgent(); if (log.isDebugEnabled()) _agent.setDebug(1); _agent.start(); // Publish agent in servlet context filterConfig.getServletContext().setAttribute("org.josso.agent", _agent); } catch (Exception e) { throw new ServletException("Error starting SSO Agent : " + e.getMessage(), e); } } }
From source file:de.betterform.agent.web.filter.XFormsFilter.java
/** * Filter initialisation/* w w w .j ava2 s . c om*/ * * @see http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/Filter.html#init(javax.servlet.FilterConfig) */ public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; webFactory = new WebFactory(); webFactory.setServletContext(filterConfig.getServletContext()); try { webFactory.initConfiguration(XFormsFilter.USERAGENT); defaultRequestEncoding = webFactory.getConfig().getProperty("defaultRequestEncoding", defaultRequestEncoding); webFactory.initLogging(this.getClass()); String realPath = WebFactory.getRealPath(".", this.filterConfig.getServletContext()); webFactory.initTransformerService(realPath); // webFactory.initXFormsSessionCache(); // todo: still needed???? } catch (XFormsConfigException e) { throw new ServletException(e); } }
From source file:org.josso.liferay6.agent.LiferaySSOAgentFilter.java
public void init(FilterConfig filterConfig) { super.init(filterConfig); // Validate and update our current component state ServletContext ctx = filterConfig.getServletContext(); ctx.setAttribute(KEY_SESSION_MAP, new HashMap()); if (_agent == null) { try {//w w w.ja v a 2s . c o m Lookup lookup = Lookup.getInstance(); lookup.init("josso-agent-config.xml"); // For spring compatibility ... // We need at least an abstract SSO Agent _agent = (HttpSSOAgent) lookup.lookupSSOAgent(); if (log.isDebugEnabled()) _agent.setDebug(1); _agent.start(); // Publish agent in servlet context filterConfig.getServletContext().setAttribute("org.josso.agent", _agent); } catch (Exception e) { _log.error("Error starting SSO Agent", e); } } }
From source file:org.apache.atlas.web.filters.AtlasAuthenticationFilter.java
@Override public void initializeSecretProvider(FilterConfig filterConfig) throws ServletException { LOG.debug("AtlasAuthenticationFilter :: initializeSecretProvider {}", filterConfig); secretProvider = (SignerSecretProvider) filterConfig.getServletContext() .getAttribute(AuthenticationFilter.SIGNER_SECRET_PROVIDER_ATTRIBUTE); if (secretProvider == null) { // As tomcat cannot specify the provider object in the configuration. // It'll go into this path String configPrefix = filterConfig.getInitParameter(CONFIG_PREFIX); configPrefix = (configPrefix != null) ? configPrefix + "." : ""; try {//w ww . j av a2s . co m secretProvider = AuthenticationFilter.constructSecretProvider(filterConfig.getServletContext(), super.getConfiguration(configPrefix, filterConfig), false); this.isInitializedByTomcat = true; } catch (Exception ex) { throw new ServletException(ex); } } signer = new Signer(secretProvider); }
From source file:org.xmlactions.web.conceal.HttpPager.java
/** * @see Servlet#init(ServletConfig)/*from www. j a v a 2s .c o 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:org.josso.liferay5.agent.LiferaySSOAgentFilter.java
public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); // Validate and update our current component state ServletContext ctx = filterConfig.getServletContext(); ctx.setAttribute(KEY_SESSION_MAP, new HashMap()); if (_agent == null) { try {/*from w w w. jav a 2s . c o m*/ Lookup lookup = Lookup.getInstance(); lookup.init("josso-agent-config.xml"); // For spring compatibility ... // We need at least an abstract SSO Agent _agent = (HttpSSOAgent) lookup.lookupSSOAgent(); if (log.isDebugEnabled()) _agent.setDebug(1); _agent.start(); // Publish agent in servlet context filterConfig.getServletContext().setAttribute("org.josso.agent", _agent); } catch (Exception e) { throw new ServletException("Error starting SSO Agent : " + e.getMessage(), e); } } }
From source file:net.hedtech.banner.filters.ZKPageFilter2.java
@Override public void init(FilterConfig fc) { super.init(fc); this.filterConfig = fc; containerTweaks = new ContainerTweaks(); Config config = new Config(fc); Grails5535Factory defaultFactory = new Grails5535Factory(config); // TODO revert once Sitemesh bug is fixed fc.getServletContext().setAttribute(FACTORY_SERVLET_CONTEXT_ATTRIBUTE, defaultFactory); defaultFactory.refresh();/*from w ww . ja v a2 s. c o m*/ FactoryHolder.setFactory(defaultFactory); contentProcessor = new PageParser2ContentProcessor(defaultFactory); decoratorMapper = defaultFactory.getDecoratorMapper(); applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(fc.getServletContext()); layoutViewResolver = WebUtils.lookupViewResolver(applicationContext); final GrailsApplication grailsApplication = GrailsWebUtil.lookupApplication(fc.getServletContext()); String encoding = (String) grailsApplication.getFlatConfig().get(CONFIG_OPTION_GSP_ENCODING); if (encoding != null) { defaultEncoding = encoding; } Map<String, PersistenceContextInterceptor> interceptors = applicationContext .getBeansOfType(PersistenceContextInterceptor.class); if (!interceptors.isEmpty()) { persistenceInterceptor = interceptors.values().iterator().next(); } }
From source file:gov.nih.nci.cabig.caaers.web.filters.BadInputFilter.java
/** * {@inheritDoc}// w w w . j av a 2 s . c o m */ public void init(FilterConfig filterConfig) throws ServletException { servletContext = filterConfig.getServletContext(); // Parse the Filter's init parameters. String allowString = filterConfig.getInitParameter("allowURIs"); if (!StringUtils.isBlank(allowString)) { this.allowURIs = Arrays.asList(allowString.split(",\\s*")); } String allowParams = filterConfig.getInitParameter("allowParams"); if (!StringUtils.isBlank(allowParams)) { this.allowParams = Arrays.asList(allowParams.split(",\\s*")); } setAllow(filterConfig.getInitParameter("allow")); setDeny(filterConfig.getInitParameter("deny")); String initParam = filterConfig.getInitParameter("escapeQuotes"); if (initParam != null) { boolean flag = Boolean.parseBoolean(initParam); setEscapeQuotes(flag); } initParam = filterConfig.getInitParameter("escapeAngleBrackets"); if (initParam != null) { boolean flag = Boolean.parseBoolean(initParam); setEscapeAngleBrackets(flag); } initParam = filterConfig.getInitParameter("escapeHtmlFormTags"); if (initParam != null) { boolean flag = Boolean.parseBoolean(initParam); setEscapeHtmlFormTags(flag); } initParam = filterConfig.getInitParameter("escapeNewlines"); if (initParam != null) { boolean flag = Boolean.parseBoolean(initParam); setEscapeNewlines(flag); } initParam = filterConfig.getInitParameter("escapeJavaScript"); if (initParam != null) { boolean flag = Boolean.parseBoolean(initParam); setEscapeJavaScript(flag); } // logger.debug(toString() + " initialized."); logger.debug(toString() + " initialized."); }
From source file:org.auraframework.http.AuraTestFilter.java
public void processInjection(FilterConfig filterConfig) { if (testContextAdapter == null) { SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, filterConfig.getServletContext()); }//from w w w . j a v a2s. c om }