/** * @see {@link ServletConfigUtils#getInitParameter(String, String, Object...)} * @param paramName * @param defaultValue * @param configs * @return */ public static String getInitParameter(String paramName, String defaultValue, Object ... configs) { return ServletConfigUtils.getInitParameter(paramName, defaultValue, configs); }
/** * Returns the client component manager instance if available. * @param servletContext * @return */ public static ComponentManager getClientComponentManager(ServletContext servletContext) { String attributeName = ServletConfigUtils.getInitParameter(null, servletContext, CLIENT_COMPONENT_MANAGER_CONTEXT_ATTRIBUTE_NAME_INIT_PARAM, CLIENT_COMPONENT_MANANGER_DEFAULT_CONTEXT_ATTRIBUTE_NAME); return (ComponentManager)servletContext.getAttribute(attributeName); }
@Override public void init(ServletConfig servletConfig) throws ServletException { requestCharacterEncoding = ServletConfigUtils.getInitParameter(servletConfig, null, "requestCharacterEncoding", null); defaultLoginFormPagePath = ServletConfigUtils.getInitParameter(servletConfig, null, "loginFormPagePath", null); defaultLoginResourcePath = ServletConfigUtils.getInitParameter(servletConfig, null, "loginResource", DEFAULT_LOGIN_RESOURCE_PATH); defaultLoginSecurityCheckFormPagePath = ServletConfigUtils.getInitParameter(servletConfig, null, "loginSecurityCheckFormPagePath", null); defaultLoginErrorPagePath = ServletConfigUtils.getInitParameter(servletConfig, null, "loginErrorPage", null); freeMarkerConfiguration = new Configuration(); freeMarkerConfiguration.setObjectWrapper(new DefaultObjectWrapper()); freeMarkerConfiguration.setTemplateLoader(new ClassTemplateLoader(getClass(), "")); }
/** * {@inheritDoc} */ @Override public void init(ServletConfig config) throws ServletException { super.init(config); baseBinariesContentPath = ServletConfigUtils.getInitParameter(config, null, BASE_BINARIES_CONTENT_PATH_INIT_PARAM, baseBinariesContentPath); contentDispositionFilenamePropertyNames = StringUtils.split(ServletConfigUtils.getInitParameter(config, null, CONTENT_DISPOSITION_FILENAME_PROPERTY_INIT_PARAM, null), ", \t\r\n"); // Parse mime types from init-param contentDispositionContentTypes = new HashSet<String>(); String mimeTypesString = ServletConfigUtils.getInitParameter(config, null, CONTENT_DISPOSITION_CONTENT_TYPES_INIT_PARAM, null); if (mimeTypesString != null) { contentDispositionContentTypes.addAll(Arrays.asList(StringUtils.split(mimeTypesString, ", \t\r\n"))); } binaryDataPropName = ServletConfigUtils.getInitParameter(config, null, BINARY_DATA_PROP_NAME_INIT_PARAM, binaryDataPropName); binaryMimeTypePropName = ServletConfigUtils.getInitParameter(config, null, BINARY_MIME_TYPE_PROP_NAME_INIT_PARAM, binaryMimeTypePropName); binaryLastModifiedPropName = ServletConfigUtils.getInitParameter(config, null, BINARY_LAST_MODIFIED_PROP_NAME_INIT_PARAM, binaryLastModifiedPropName); contentDispositionFileNameEncoding = ServletConfigUtils.getInitParameter(config, null, CONTENT_DISPOSITION_FILENAME_ENCODING_INIT_PARAM , contentDispositionFileNameEncoding); if(!USER_AGENT_AGNOSTIC_CONTENT_DISPOSITION_FILENAME_ENCODING.equals(contentDispositionFileNameEncoding) && !USER_AGENT_SPECIFIC_CONTENT_DISPOSITION_FILENAME_ENCODING.equals(contentDispositionFileNameEncoding)) { throw new ServletException("Invalid init-param: the only allowed values for contentDispositionFilenameEncoding are '"+USER_AGENT_AGNOSTIC_CONTENT_DISPOSITION_FILENAME_ENCODING+"' or '"+USER_AGENT_SPECIFIC_CONTENT_DISPOSITION_FILENAME_ENCODING+"'"); } }
protected boolean getBooleanInitParameter(String paramName, boolean defaultValue) { String value = ServletConfigUtils.getInitParameter(getServletConfig(), null, paramName, null); if (value != null) { return Boolean.parseBoolean(value); } return defaultValue; }
protected long getLongInitParameter(String paramName, long defaultValue) { String value = ServletConfigUtils.getInitParameter(getServletConfig(), null, paramName, null); if (value != null) { try { return Long.parseLong(value); } catch (NumberFormatException e) { log.warn("Expecting type long for parameter '{}', got '{}'", paramName, value); } } return defaultValue; }
protected String getConfigOrContextInitParameter(String paramName, String defaultValue) { String value = ServletConfigUtils.getInitParameter(null, getServletContext(), paramName, defaultValue); return (value != null ? value.trim() : null); }
super.init(config); String param = ServletConfigUtils.getInitParameter(config, config.getServletContext(), ALLOWED_STATIC_RESOURCE_PATH_PREFIXES_PARAM, null); param = ServletConfigUtils.getInitParameter(config, config.getServletContext(), ALLOWED_STATIC_RESOURCE_PATH_POSTFIXES_PARAM, null); param = ServletConfigUtils.getInitParameter(config, config.getServletContext(), FORBIDDEN_STATIC_RESOURCE_PATH_PREFIXES_PARAM, null); param = ServletConfigUtils.getInitParameter(config, config.getServletContext(), FORBIDDEN_STATIC_RESOURCE_PATH_POSTFIXES_PARAM, null);
protected String getInitParameter(String paramName, String defaultValue) { return ServletConfigUtils.getInitParameter(getServletConfig(), null, paramName, defaultValue); }
protected String getConfigOrContextInitParameter(String paramName, String defaultValue) { String value = ServletConfigUtils.getInitParameter(getServletConfig(), getServletConfig().getServletContext(), paramName, defaultValue); return (value != null ? value.trim() : null); }
List<Configuration> configs = new ArrayList<Configuration>(); String fileParam = ServletConfigUtils.getInitParameter(null, getServletContext(), HST_CONFIGURATION_PARAM, null); fileParam = ServletConfigUtils.getInitParameter(null, getServletContext(), HST_CONFIG_PROPERTIES_PARAM, null); Configuration config = loadConfigurationFromProperties(getResourceFile(fileParam, true)); if (config != null) {