List of usage examples for javax.servlet ServletConfig getInitParameter
public String getInitParameter(String name);
From source file:com.almende.eve.transport.http.DebugServlet.java
@Override public void init(final ServletConfig config) throws ServletException { final String servletUrl = config.getInitParameter("ServletUrl"); if (servletUrl != null) { try {/*ww w. j ava 2 s .c om*/ myUrl = new URI(servletUrl); } catch (final URISyntaxException e) { LOG.log(Level.WARNING, "Couldn't init servlet, url invalid. ('ServletUrl' init param)", e); } } else { LOG.warning("Servlet init parameter 'ServletUrl' is required!"); } super.init(config); }
From source file:org.ebayopensource.turmeric.policy.adminui.server.PlcImportServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); if (config.getInitParameter("PolicyServiceURL") != null) { policyServiceURL = config.getInitParameter("PolicyServiceURL"); }/*ww w. jav a 2s .c om*/ if (config.getInitParameter("impPolicyPrefix") != null) { impPolicyPrefix = config.getInitParameter("impPolicyPrefix"); } if (config.getInitParameter("impSGPrefix") != null) { impSGPrefix = config.getInitParameter("impSGPrefix"); } }
From source file:org.etudes.tool.melete.MeleteJsfTool.java
/** * Initialize the servlet.//from w ww . j av a2s. c o m * * @param config * The servlet config. * @throws ServletException */ public void init(ServletConfig config) throws ServletException { super.init(config); m_default = config.getInitParameter("default"); m_path = config.getInitParameter("path"); m_defaultToLastView = "true".equals(config.getInitParameter("default.last.view")); // make sure there is no "/" at the end of the path if (m_path != null && m_path.endsWith("/")) { m_path = m_path.substring(0, m_path.length() - 1); } M_log.info("init: default: " + m_default + " path: " + m_path); }
From source file:org.apache.servicemix.http.HttpManagedServlet.java
public void init(ServletConfig config) throws ServletException { super.init(config); // Retrieve spring application context ApplicationContext applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); // Retrieve//w ww. j a v a 2s . com String containerName = config.getInitParameter(CONTAINER_PROPERTY); if (containerName == null) { containerName = CONTAINER_DEFAULT; } JBIContainer container = (JBIContainer) applicationContext.getBean(containerName); if (container == null) { throw new IllegalStateException("Unable to find jbi container " + containerName); } String componentName = config.getInitParameter(COMPONENT_PROPERTY); if (componentName == null) { componentName = COMPONENT_DEFAULT; } ComponentMBeanImpl componentMBean = container.getComponent(componentName); if (componentMBean == null) { throw new IllegalStateException("Unable to find component " + componentName); } HttpComponent component = (HttpComponent) componentMBean.getComponent(); String mapping = config.getInitParameter(MAPPING_PROPERTY); if (mapping != null) { component.getConfiguration().setMapping(mapping); } processor = component.getMainProcessor(); }
From source file:be.fedict.eid.applet.service.AbstractAppletServiceServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); LOG.debug("init"); this.unmarshaller = new Unmarshaller(new AppletProtocolMessageCatalog()); String skipSecureConnectionCheck = config.getInitParameter(SKIP_SECURE_CONNECTION_CHECK_INIT_PARAM); if (null != skipSecureConnectionCheck) { this.skipSecureConnectionCheck = Boolean.parseBoolean(skipSecureConnectionCheck); LOG.debug("skipping secure connection check: " + this.skipSecureConnectionCheck); }/*from ww w.ja va2 s .co m*/ }
From source file:org.wapama.web.server.UUIDBasedRepositoryServlet.java
/** * Initiates the repository servlet.// w w w . ja v a 2 s . c o m * * The behavior is based on the initialization parameters read from web.xml * * repositoryServiceType: * -null * The classloader of the class is investigated to see if we are operating * in a OSGi context. If yes we use osgi. * -default * We will use the _factory static field to create the repository. * -osgi * We will use the _osgiFactory to create the repository. * * Please refer to the documentation of both fields for further information. * */ @Override public void init(ServletConfig config) throws ServletException { super.init(config); try { String repoType = config.getInitParameter("repositoryServiceType"); if (repoType == null) { // look up the current class loader if (UUIDBasedRepositoryServlet.class.getClassLoader() instanceof BundleReference) { repoType = "osgi"; } else { repoType = "default"; } } if ("default".equals(repoType)) { _repository = _factory.createRepository(config); } else if ("osgi".equals(repoType)) { _repository = _osgiFactory.createRepository(config); } else { throw new IllegalArgumentException( "Invalid value for init " + "parameter repositoryServiceType : " + repoType); } _repository.configure(this); } catch (Exception e) { if (e instanceof ServletException) { throw (ServletException) e; } throw new ServletException(e); } }
From source file:freeciv.servlet.ProxyServlet.java
/** * Initialize the <code>ProxyServlet</code> * @param servletConfig The Servlet configuration passed in by the servlet conatiner *///from w ww.ja v a 2 s . c o m public void init(ServletConfig servletConfig) { // Get the proxy host String stringProxyHostNew = servletConfig.getInitParameter("proxyHost"); if (stringProxyHostNew == null || stringProxyHostNew.length() == 0) { throw new IllegalArgumentException("Proxy host not set, please set init-param 'proxyHost' in web.xml"); } this.setProxyHost(stringProxyHostNew); // Get the proxy path if specified String stringProxyPathNew = servletConfig.getInitParameter("proxyPath"); if (stringProxyPathNew != null && stringProxyPathNew.length() > 0) { this.setProxyPath(stringProxyPathNew); } // Get the maximum file upload size if specified String stringMaxFileUploadSize = servletConfig.getInitParameter("maxFileUploadSize"); }
From source file:com.liferay.portal.servlet.SharedServletWrapper.java
public void init(ServletConfig sc) throws ServletException { super.init(sc); ServletContext ctx = getServletContext(); _servletContextName = StringUtil.replace(ctx.getServletContextName(), StringPool.SPACE, StringPool.UNDERLINE);//from ww w . java 2s . co m _servletClass = sc.getInitParameter("servlet-class"); ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { _servletInstance = (Servlet) contextClassLoader.loadClass(_servletClass).newInstance(); } catch (ClassNotFoundException cnfe) { throw new ServletException(cnfe.getMessage()); } catch (IllegalAccessException iae) { throw new ServletException(iae.getMessage()); } catch (InstantiationException ie) { throw new ServletException(ie.getMessage()); } if (_servletInstance instanceof HttpServlet) { _httpServletInstance = (HttpServlet) _servletInstance; _httpServletInstance.init(sc); } else { _servletInstance.init(sc); } }
From source file:de.tudarmstadt.lt.lm.web.servlet.LanguageModelProviderServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); String port = config.getInitParameter("rmiport"); _host = config.getInitParameter("rmihost"); if (_host == null || port == null) { LOG.warn("rmihost or rmiport parameter not specified. Please specify correct parameters in web.xml:{}.", getClass().getSimpleName()); if (_host == null) _host = "localhost"; if (port == null) port = String.valueOf(Registry.REGISTRY_PORT); }//from ww w. jav a2s . c om try { _port = Integer.parseInt(port); } catch (NumberFormatException e) { LOG.warn( "rmiport option value '{}' could not be parsed: {} {}. Please specify correct parameter in web.xml:{}.", port, e, getClass().getSimpleName(), e.getMessage(), getClass().getSimpleName()); _port = Registry.REGISTRY_PORT; } }
From source file:org.infoscoop.web.KeywordRankingServlet.java
public void init(ServletConfig config) throws ServletException { super.init(config); String param_rankingPeriod_max = config.getInitParameter("rankingPeriod_max"); String param_rankingNum_max = config.getInitParameter("rankingNum_max"); try {//www . j a v a2 s .c o m if (param_rankingPeriod_max != null) RANKING_PERIOD_MAX = Integer.parseInt(param_rankingPeriod_max); } catch (Exception e) { log.error("param_rankingPeriod_max must be a number. RANKING_PERIOD_MAX = " + param_rankingPeriod_max); throw new ServletException(); } try { if (param_rankingNum_max != null) RANKING_NUM_MAX = Integer.parseInt(param_rankingNum_max); } catch (Exception e) { log.error("param_rankingNum_max must be a number. RANKING_NUM_MAX = " + param_rankingNum_max); throw new ServletException(); } }