List of usage examples for javax.servlet ServletConfig getInitParameter
public String getInitParameter(String name);
From source file:net.morphbank.mbsvc3.webservices.RestfulService.java
public void init(ServletConfig config) throws ServletException { super.init(config); persistence = config.getInitParameter(CONFIG_PARAM); filepath = config.getInitParameter(FILEPATH_PARAM); servicePrefix = config.getInitParameter(SERVICE_PARAM); initObject();/*from www . ja v a 2 s . com*/ }
From source file:com.silverpeas.servlets.upload.AjaxFileUploadServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); uploadDir = config.getInitParameter(UPLOAD_DIRECTORY); whiteList = config.getInitParameter(WHITE_LIST); }
From source file:org.cloudfoundry.identity.uaa.config.YamlServletProfileInitializer.java
@Override public void initialize(ConfigurableWebApplicationContext applicationContext) { Resource resource = null;/*from w ww . java 2 s.com*/ ServletContext servletContext = applicationContext.getServletContext(); WebApplicationContextUtils.initServletPropertySources( applicationContext.getEnvironment().getPropertySources(), servletContext, applicationContext.getServletConfig()); ServletConfig servletConfig = applicationContext.getServletConfig(); String locations = servletConfig == null ? null : servletConfig.getInitParameter(PROFILE_CONFIG_FILE_LOCATIONS); resource = getResource(servletContext, applicationContext, locations); if (resource == null) { servletContext.log("No YAML environment properties from servlet. Defaulting to servlet context."); locations = servletContext.getInitParameter(PROFILE_CONFIG_FILE_LOCATIONS); resource = getResource(servletContext, applicationContext, locations); } try { servletContext.log("Loading YAML environment properties from location: " + resource); YamlMapFactoryBean factory = new YamlMapFactoryBean(); factory.setResolutionMethod(ResolutionMethod.OVERRIDE_AND_IGNORE); List<Resource> resources = new ArrayList<Resource>(); String defaultLocation = servletConfig == null ? null : servletConfig.getInitParameter(PROFILE_CONFIG_FILE_DEFAULT); if (defaultLocation != null) { Resource defaultResource = new ClassPathResource(defaultLocation); if (defaultResource.exists()) { resources.add(defaultResource); } } resources.add(resource); factory.setResources(resources.toArray(new Resource[resources.size()])); Map<String, Object> map = factory.getObject(); String yamlStr = (new Yaml()).dump(map); map.put(rawYamlKey, yamlStr); NestedMapPropertySource properties = new NestedMapPropertySource("servletConfigYaml", map); applicationContext.getEnvironment().getPropertySources().addLast(properties); applySpringProfiles(applicationContext.getEnvironment(), servletContext); applyLog4jConfiguration(applicationContext.getEnvironment(), servletContext); } catch (Exception e) { servletContext.log("Error loading YAML environment properties from location: " + resource, e); } }
From source file:org.echocat.nodoodle.server.ServiceServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); final WebApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(config.getServletContext()); final String serviceName = config.getInitParameter(SERVICE_PARAM); if (StringUtils.isEmpty(serviceName)) { throw new ServletException("Required initParam " + SERVICE_PARAM + " not set."); }/* w ww. j a v a2 s. c o m*/ try { _service = applicationContext.getBean(serviceName, HttpService.class); } catch (NoSuchBeanDefinitionException e) { throw new ServletException("No service '" + serviceName + "' (defined under initParam '" + SERVICE_PARAM + "') could not be found.", e); } try { _service.init(config.getServletContext()); } catch (Exception e) { throw new ServletException("Could not initiate the service: " + _service, e); } }
From source file:org.xchain.framework.servlet.CatalogServlet.java
public void init(ServletConfig config) throws ServletException { super.init(config); // read the base catalog name. baseCatalogName = config.getInitParameter(BASE_CATALOG_NAME_PARAM); if (baseCatalogName == null) { baseCatalogName = DEFAULT_BASE_CATALOG_NAME; }//ww w .jav a 2 s . c om // log the config. if (log.isDebugEnabled()) { log.debug("Base Catalog Name: " + baseCatalogName); } }
From source file:com.ucap.uccc.cmis.impl.webservices.CmisWebServicesServlet.java
private String resPathFor(ServletConfig config, String filename) { String rp = config.getInitParameter("resourece.path"); if (rp == null || rp.trim().length() == 0) { return pathOfSource(filename); } else {/*ww w . j a v a 2 s. c om*/ String s = File.separator; return (rp.endsWith(s)) ? rp + filename : rp + s + filename; } }
From source file:org.webguitoolkit.ui.http.PageServlet.java
public void init(ServletConfig sc) throws ServletException { super.init(sc); String imports = sc.getInitParameter(IMPORT); // parse string imports statements are seperated by ; if (StringUtils.isNotEmpty(imports)) { impArray = StringUtils.split(imports, ';'); // need to remove all the whitespace before and after if (impArray != null) { for (int i = 0; i < impArray.length; i++) { impArray[i] = StringUtils.trimToEmpty(impArray[i]); }// w w w .j av a 2 s . c o m } } else { impArray = null; } this.initPageMappings(sc); }
From source file:com.vaadin.terminal.gwt.server.SpringApplicationOSGiServlet.java
@Override public void init(ServletConfig servletConfig) throws ServletException { // TODO Auto-generated method stub super.init(servletConfig); applicationParam = servletConfig.getInitParameter("application"); if (applicationParam == null) { throw new ServletException("Application not specified in servlet parameters"); }//from w w w.ja va 2 s . c o m versionParam = getInitParameter("version"); if (versionParam == null) { throw new ServletException("Bundle Version not specified in servlet parameters"); } beanParam = getInitParameter("bean"); if (beanParam == null) { throw new ServletException("Bean Name not specified in servlet parameters"); } }
From source file:net.lightbody.bmp.proxy.jetty.servlet.Forward.java
public void init(ServletConfig config) throws ServletException { super.init(config); Enumeration enm = config.getInitParameterNames(); while (enm.hasMoreElements()) { String path = (String) enm.nextElement(); String forward = config.getInitParameter(path); _forwardMap.put(path, forward);/*from ww w. j av a 2s . c o m*/ } }
From source file:net.morphbank.mbsvc3.webservices.RestServiceExcelUpload.java
public void init(ServletConfig config) throws ServletException { super.init(config); // setup persistence unit from parameter, if available folderPath = config.getInitParameter("filepath"); propertyFile = config.getInitParameter("propertyFile"); RequestParams.initService(config);//from ww w . j a v a 2 s . c o m }