List of usage examples for javax.servlet ServletConfig getInitParameter
public String getInitParameter(String name);
From source file:dhbw.ka.mwi.businesshorizon2.SpringApplicationServlet.java
/** * Diese Methode wird einmal beim Initialisieren aufgerufen. Dort werden die Konfigurationseinstellungen * aus der web.xml gelesen. Darueberhinaus wird ein Spring-Application-Context aus der servletConfig * geholt, mit dem es moeglich ist, Beans mit Session-Scope zu erzeugen. * //w w w .j a v a 2 s. c o m * @author Christian Gahlert */ @SuppressWarnings("unchecked") @Override public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); applicationBean = servletConfig.getInitParameter("applicationBean"); if (applicationBean == null) { throw new ServletException("ApplicationBean not specified in servlet parameters"); } applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletConfig.getServletContext()); applicationClass = (Class<? extends Application>) applicationContext.getType(applicationBean); }
From source file:fr.norad.servlet.sample.html.template.IndexTemplateServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); String tplPath = config.getInitParameter(TEMPLATE_PATH); Validate.notNull(tplPath, "{} init param must be set", TEMPLATE_PATH); loadProperties(config);/*from w w w .j a va 2 s . c o m*/ contextPathSuffix = config.getInitParameter(CONTEXT_PATH_SUFFIX); template = loadTemplate(tplPath); }
From source file:org.infoscoop.web.InitializeServlet.java
/** * read and the initialize the Log4j property. * @param config :setting for servlet// ww w. j a v a 2 s . c o m */ protected void initLog4jProperties(ServletConfig config) throws ServletException { String file = config.getInitParameter("log4j-init-file"); // if the log4j-init-file is not set, then no point in trying if (file != null) { InputSource is = getResource(config, file); Element element = null; try { DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = db.parse(is); element = doc.getDocumentElement(); } catch (Exception e) { throw new ServletException(e); } if (element != null) DOMConfigurator.configure(element); } else { throw new ServletException(""); } if (log.isInfoEnabled()) log.info("initialized Log4J."); }
From source file:org.jboss.web.loadbalancer.LoadbalancerServlet.java
public void init(ServletConfig config) throws ServletException { super.init(config); loadbalancerName = config.getInitParameter("loadbalancer-service-name"); log.debug("Servlet init ready"); }
From source file:com.thinkberg.webdav.servlet.MoxoWebDAVServlet.java
public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); String rootUri = servletConfig.getInitParameter("vfs.uri"); String authDomain = servletConfig.getInitParameter("vfs.auth.domain"); String authUser = servletConfig.getInitParameter("vfs.auth.user"); String authPass = servletConfig.getInitParameter("vfs.auth.password"); try {/*w w w .j a va 2 s . c om*/ StaticUserAuthenticator userAuthenticator = new StaticUserAuthenticator(authDomain, authUser, authPass); FileSystemOptions options = new FileSystemOptions(); DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, userAuthenticator); VFSBackend.initialize(rootUri, options); } catch (FileSystemException e) { LOG.error(String.format("can't create file system backend for '%s'", rootUri)); } }
From source file:fr.putnami.pwt.core.service.server.service.BasicCommandService.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); String servicesParam = config.getInitParameter(BasicCommandService.PARAM_SERVICES); if (servicesParam != null) { String[] serviceToInstanciate = servicesParam.split(";"); if (serviceToInstanciate != null && serviceToInstanciate.length > 0) { for (String serviceName : serviceToInstanciate) { if (serviceName != null && serviceName.length() > 0) { try { this.getClass(); Class<?> serviceClass = Class.forName(serviceName); Object service = serviceClass.newInstance(); for (Class<?> serviceInterface : serviceClass.getInterfaces()) { this.injectService(serviceInterface, service); }//from w w w . j av a 2 s .c om } catch (ClassNotFoundException e) { throw new ServletException("Can not load service class " + serviceName, e); } catch (InstantiationException e) { throw new ServletException("Can not instantiate service " + serviceName, e); } catch (IllegalAccessException e) { throw new ServletException("Can not instantiate service " + serviceName, e); } } } } } }
From source file:com.rabidgremlin.onepagewebstarter.guice.CxfGuiceServlet.java
@Override protected List<Object> getProviders(ServletConfig servletConfig, String splitChar) throws ServletException { List<Object> providers = new ArrayList<Object>(); String providersList = servletConfig.getInitParameter("jaxrs.providers"); if (providersList == null) { return providers; }//from www.j a v a2s . c om Injector injector = (Injector) servletConfig.getServletContext().getAttribute(Injector.class.getName()); String[] classNames = StringUtils.split(providersList, splitChar); for (String cName : classNames) { Class<?> cls = loadClass(StringUtils.strip(cName)); providers.add(injector.getInstance(cls)); } return providers; }
From source file:jp.mathes.databaseWiki.dav.DavServlet.java
@Override public void init(final ServletConfig config) throws ServletException { try {/* w w w. j a v a2s.c o m*/ this.config = config; this.cutoffPath = config.getInitParameter("cutoff.path"); this.httpManager = new ServletHttpManager(this); this.httpManager.init(new ApplicationConfig(config), this.httpManager); } catch (Throwable ex) { throw new RuntimeException(ex); } }
From source file:cz.muni.fi.webmias.ProcessServlet.java
@Override public void init(ServletConfig config) throws ServletException { queryLog = new File(config.getInitParameter("querylog")); }
From source file:be.fedict.eid.dss.sp.servlet.UploadServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); this.postPage = config.getInitParameter(POST_PAGE_INIT_PARAM); }