List of usage examples for javax.servlet ServletConfig getInitParameter
public String getInitParameter(String name);
From source file:org.codice.admin.router.SparkServlet.java
private void populateWrapperSupplier(ServletConfig config) { // Do not override an injected supplier through initialization if (requestSupplier != null) { return;/*ww w .j a v a 2s . c om*/ } String wrapperSupplierName = config.getInitParameter(WRAPPER_SUPPLIER_PARAM_NAME); if (StringUtils.isNotBlank(wrapperSupplierName)) { try { Class<?> wrapperClass = Class.forName(wrapperSupplierName); if (BiFunction.class.isAssignableFrom(wrapperClass)) { requestSupplier = (BiFunction<HttpServletRequest, String, HttpServletRequestWrapper>) wrapperClass .newInstance(); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOGGER.debug( "Error converting {} to BiFunction<HttpServletRequest, String, HttpServletRequestWrapper>; " + "falling back to default", wrapperSupplierName, e); } } if (requestSupplier == null) { requestSupplier = DEFAULT_REQ_FUNC; } }
From source file:org.jahia.services.atmosphere.AtmosphereServlet.java
@Override public void init(final ServletConfig sc) throws ServletException { ServletConfig scFacade;/*from w ww.ja va2 s . c o m*/ String asyncSupport = SettingsBean.getInstance().getAtmosphereAsyncSupport(); // override asyncSupport only if explicitly set via jahia.properties or not set at all if (StringUtils.isNotEmpty(asyncSupport) || sc.getInitParameter(PROPERTY_COMET_SUPPORT) == null) { final String implName = StringUtils.defaultIfBlank(asyncSupport, DEFAULT_ASYNC_SUPPORT); scFacade = new ServletConfig() { @Override public String getInitParameter(String name) { return PROPERTY_COMET_SUPPORT.equals(name) ? implName : sc.getInitParameter(name); } @Override public Enumeration<String> getInitParameterNames() { ArrayList<String> names = Lists.newArrayList(PROPERTY_COMET_SUPPORT); CollectionUtils.addAll(names, sc.getInitParameterNames()); return Collections.enumeration(names); } @Override public ServletContext getServletContext() { return sc.getServletContext(); } @Override public String getServletName() { return sc.getServletName(); } }; } else { scFacade = sc; } super.init(scFacade); }
From source file:be.fedict.eid.applet.service.impl.handler.HelloMessageHandler.java
public void init(ServletConfig config) throws ServletException { String hostname = config.getInitParameter(HOSTNAME_INIT_PARAM_NAME); if (null != hostname) { this.includeHostname = true; }/*from w w w . java 2 s . co m*/ String inetAddress = config.getInitParameter(INET_ADDRESS_INIT_PARAM_NAME); if (null != inetAddress) { this.includeInetAddress = true; } String channelBindingServerCertificate = config.getInitParameter(CHANNEL_BINDING_SERVER_CERTIFICATE); if (null != channelBindingServerCertificate) { this.serverCertificateChannelBinding = true; } String channelBindingService = config.getInitParameter(CHANNEL_BINDING_SERVICE); if (null != channelBindingService) { this.serverCertificateChannelBinding = true; } }
From source file:net.morphbank.mbsvc3.webservices.RestService.java
public void init(ServletConfig config) throws ServletException { super.init(config); // setup persistence unit from parameter, if available folderPath = config.getInitParameter("filepath"); RequestParams.initService(config);// ww w.j a va 2 s . c o m setProperties(); }
From source file:org.codice.admin.router.SparkServlet.java
private void populateSparkApplications(ServletConfig config) { // Do not override injected spark applications through initialization if (!CollectionUtils.isEmpty(sparkApplications)) { return;//from ww w. j ava 2s . c o m } String applications = config.getInitParameter(APPLICATION_CLASS_PARAM); if (StringUtils.isNotBlank(applications)) { sparkApplications.addAll(Pattern.compile(",").splitAsStream(applications).map(String::trim) .map(this::getApplication).filter(Objects::nonNull).collect(Collectors.toList())); } }
From source file:org.springframework.faces.mvc.servlet.FacesHandlerAdapterTests.java
public void testDelegatingServletConfig() throws Exception { Properties initParameters = new Properties(); initParameters.setProperty("testkey", "testvalue"); ServletContext servletContext = (ServletContext) EasyMock.createMock(ServletContext.class); adapter.setInitParameters(initParameters); adapter.setServletContext(servletContext); adapter.setOverrideInitParameters(false); adapter.setFacesServletClass(MockServlet.class); adapter.afterPropertiesSet();//from w w w. j ava 2s . c om MockServlet servlet = (MockServlet) adapter.getFacesServlet(); ServletConfig config = servlet.getServletConfig(); assertTrue(EnumerationUtils.toList(config.getInitParameterNames()).contains("testkey")); assertEquals("testvalue", config.getInitParameter("testkey")); assertEquals("testAdapterBean", config.getServletName()); assertSame(servletContext, config.getServletContext()); }
From source file:org.apache.jetspeed.services.resources.VariableResourcesService.java
/** * This method is called when the Service is initialized * * @param config a ServletConfig object//from w w w . ja v a 2 s . c o m */ public synchronized void init(ServletConfig config) throws InitializationException { if (getInit()) return; String props = config.getInitParameter(TurbineServices.PROPERTIES_PATH_KEY); variables = new Hashtable(); strings = new Hashtable(); vectors = new Hashtable(); arrays = new Hashtable(); initVariables(config); super.init(config); }
From source file:org.hippoecm.repository.PingServlet.java
private String getParameter(ServletConfig config, String paramName, String defaultValue) { String initValue = config.getInitParameter(paramName); String contextValue = config.getServletContext().getInitParameter(paramName); if (isNotNullAndNotEmpty(initValue)) { return initValue; } else if (isNotNullAndNotEmpty(contextValue)) { return contextValue; } else {/* w w w. j av a2 s . c o m*/ return defaultValue; } }
From source file:org.localmatters.lesscss4j.servlet.LessCssServlet.java
protected Integer getInitParameterInteger(ServletConfig config, String name) throws ServletException { String value = config.getInitParameter(name); if (value != null) { try {/* w ww. j a va2 s . c o m*/ return Integer.parseInt(value); } catch (NumberFormatException ex) { throw new ServletException("Invalid " + name + " value:" + value, ex); } } return null; }
From source file:be.fedict.eid.applet.service.impl.handler.ContinueInsecureMessageHandler.java
public void init(ServletConfig config) throws ServletException { this.secureRandom = new SecureRandom(); this.secureRandom.setSeed(System.currentTimeMillis()); String hostname = config.getInitParameter(HelloMessageHandler.HOSTNAME_INIT_PARAM_NAME); if (null != hostname) { this.includeHostname = true; }/* w w w . j a va 2s . com*/ String inetAddress = config.getInitParameter(HelloMessageHandler.INET_ADDRESS_INIT_PARAM_NAME); if (null != inetAddress) { this.includeInetAddress = true; } String channelBindingServerCertificate = config .getInitParameter(HelloMessageHandler.CHANNEL_BINDING_SERVER_CERTIFICATE); if (null != channelBindingServerCertificate) { this.serverCertificateChannelBinding = true; } String channelBindingService = config.getInitParameter(HelloMessageHandler.CHANNEL_BINDING_SERVICE); if (null != channelBindingService) { this.serverCertificateChannelBinding = true; } }