@Override public Enumeration getInitParameterNames() { return sc.getInitParameterNames(); }
@Override Enumeration getInitParamNames() { return wrapped.getInitParameterNames(); }
@Override public String[] getPropertyNames() { return StringUtils.toStringArray(this.source.getInitParameterNames()); }
private PersistenceUnitInjectionResolver(ServletConfig servletConfig) { for (final Enumeration parameterNames = servletConfig.getInitParameterNames(); parameterNames.hasMoreElements(); ) { final String key = (String) parameterNames.nextElement(); if (key.startsWith(PERSISTENCE_UNIT_PREFIX)) { persistenceUnits.put(key.substring(PERSISTENCE_UNIT_PREFIX.length()), "java:comp/env/" + servletConfig.getInitParameter(key)); } } }
private PersistenceUnitInjectionResolver(ServletConfig servletConfig) { for (final Enumeration parameterNames = servletConfig.getInitParameterNames(); parameterNames.hasMoreElements(); ) { final String key = (String) parameterNames.nextElement(); if (key.startsWith(PERSISTENCE_UNIT_PREFIX)) { persistenceUnits.put(key.substring(PERSISTENCE_UNIT_PREFIX.length()), "java:comp/env/" + servletConfig.getInitParameter(key)); } } }
public Enumeration<String> getInitParameterNames() { if (!done.getAndSet(true)) { Enumeration en = sc.getInitParameterNames(); if (en != null) { while (en.hasMoreElements()) { String name = (String) en.nextElement(); if (!initParams.containsKey(name)) { initParams.put(name, sc.getInitParameter(name)); } } } } return Collections.enumeration(initParams.keySet()); } };
@Override public String[] getPropertyNames() { return StringUtils.toStringArray(this.source.getInitParameterNames()); }
@Override public Enumeration<String> getInitParameterNames() { return getServletConfig().getInitParameterNames(); }
/** * Create new ServletConfigPropertyValues. * @param config the ServletConfig we'll use to take PropertyValues from * @param requiredProperties set of property names we need, where * we can't accept default values * @throws ServletException if any required properties are missing */ public ServletConfigPropertyValues(ServletConfig config, Set<String> requiredProperties) throws ServletException { Set<String> missingProps = (!CollectionUtils.isEmpty(requiredProperties) ? new HashSet<>(requiredProperties) : null); Enumeration<String> paramNames = config.getInitParameterNames(); while (paramNames.hasMoreElements()) { String property = paramNames.nextElement(); Object value = config.getInitParameter(property); addPropertyValue(new PropertyValue(property, value)); if (missingProps != null) { missingProps.remove(property); } } // Fail if we are still missing properties. if (!CollectionUtils.isEmpty(missingProps)) { throw new ServletException( "Initialization from ServletConfig for servlet '" + config.getServletName() + "' failed; the following required properties were missing: " + StringUtils.collectionToDelimitedString(missingProps, ", ")); } } }
/** * Returns the names of the servlet's initialization parameters * as an <code>Enumeration</code> of <code>String</code> objects, * or an empty <code>Enumeration</code> if the servlet has no * initialization parameters. See {@link * ServletConfig#getInitParameterNames}. * * <p>This method is supplied for convenience. It gets the * parameter names from the servlet's <code>ServletConfig</code> object. * * * @return Enumeration an enumeration of <code>String</code> * objects containing the names of * the servlet's initialization parameters * */ public Enumeration getInitParameterNames() { ServletConfig sc = getServletConfig(); if (sc == null) { throw new IllegalStateException( lStrings.getString("err.servlet_config_not_initialized")); } return sc.getInitParameterNames(); }
public List<String> getInitParameterNames() { return enum2list(config.getInitParameterNames()); }
Enumeration<?> paramNameEnum = servletConfig.getInitParameterNames(); while (paramNameEnum.hasMoreElements()) { String paramName = (String) paramNameEnum.nextElement();
/** * Return all init param. * * @return the list of init params defined in web.xml or application.xml for the servlet */ public Enumeration<String> getInitParameterNames() { return framework().getServletConfig().getInitParameterNames(); }
@Override public void init() { ServletConfig config = getServletConfig(); Enumeration<?> en = config.getInitParameterNames(); ArrayList<String> list = New.arrayList(); while (en.hasMoreElements()) { String name = en.nextElement().toString(); String value = config.getInitParameter(name); if (!name.startsWith("-")) { name = "-" + name; } list.add(name); if (value.length() > 0) { list.add(value); } } String[] args = list.toArray(new String[0]); server = new WebServer(); server.setAllowChunked(false); server.init(args); }
/** * Create new ServletConfigPropertyValues. * @param config the ServletConfig we'll use to take PropertyValues from * @param requiredProperties set of property names we need, where * we can't accept default values * @throws ServletException if any required properties are missing */ public ServletConfigPropertyValues(ServletConfig config, Set<String> requiredProperties) throws ServletException { Set<String> missingProps = (!CollectionUtils.isEmpty(requiredProperties) ? new HashSet<>(requiredProperties) : null); Enumeration<String> paramNames = config.getInitParameterNames(); while (paramNames.hasMoreElements()) { String property = paramNames.nextElement(); Object value = config.getInitParameter(property); addPropertyValue(new PropertyValue(property, value)); if (missingProps != null) { missingProps.remove(property); } } // Fail if we are still missing properties. if (!CollectionUtils.isEmpty(missingProps)) { throw new ServletException( "Initialization from ServletConfig for servlet '" + config.getServletName() + "' failed; the following required properties were missing: " + StringUtils.collectionToDelimitedString(missingProps, ", ")); } } }
Enumeration<?> paramNameEnum = servletConfig.getInitParameterNames(); while (paramNameEnum.hasMoreElements()) { String paramName = (String) paramNameEnum.nextElement();
private void info() { Enumeration<String> e = servletConfig.getInitParameterNames(); logger.trace("Configured init-params"); String n;
@Before public void setup() { Mockito.when(servletConfig.getInitParameterNames()).thenReturn(new EmptyEnumerationOfString()); Mockito.when(servletContext.getInitParameterNames()).thenReturn(new EmptyEnumerationOfString()); Mockito.when(context.getServletConfig()).thenReturn(servletConfig); Mockito.when(context.getServletContext()).thenReturn(servletContext); Mockito.when(context.getEnvironment()).thenReturn(environment); Mockito.doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { System.err.println(invocation.getArguments()[0]); return null; } }).when(servletContext).log(ArgumentMatchers.anyString()); Mockito.when(servletContext.getContextPath()).thenReturn("/context"); }
final Enumeration initParams = servletConfig.getInitParameterNames(); while (initParams.hasMoreElements()) { final String initParamName = (String) initParams.nextElement();
final Enumeration initParams = servletConfig.getInitParameterNames(); while (initParams.hasMoreElements()) { final String initParamName = (String) initParams.nextElement();