private Map<String, Object> getInitParams(WebConfig webConfig) { Map<String, Object> props = new HashMap<String, Object>(); Enumeration names = webConfig.getInitParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); props.put(name, webConfig.getInitParameter(name)); } return props; }
/* package */ ResourceConfig getWebAppResourceConfig(Map<String, Object> props, WebConfig webConfig) throws ServletException { // Default to using Web app resource config return new WebAppResourceConfig(props, webConfig.getServletContext()); }
private ResourceConfig createResourceConfig(WebConfig webConfig, Map<String, Object> props) throws ServletException { String resourceConfigClassName = webConfig.getInitParameter(RESOURCE_CONFIG_CLASS); resourceConfigClassName = webConfig.getInitParameter(APPLICATION_CONFIG_CLASS); String packages = webConfig.getInitParameter( PackagesResourceConfig.PROPERTY_PACKAGES); if (packages != null) { ResourceConfig defaultConfig = webConfig.getDefaultResourceConfig(props); if (defaultConfig != null) return defaultConfig; String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths); Constructor constructor = resourceConfigClass.getConstructor(Map.class); if (ClasspathResourceConfig.class.isAssignableFrom(resourceConfigClass)) { String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
@Override protected ResourceConfig getDefaultResourceConfig(Map<String, Object> props, WebConfig webConfig) throws ServletException { // get the excludes parameter: support the old param name for Atlassian Gadgets final String deprecatedName = "com.atlassian.plugins.rest.module.filter.ExtensionJerseyFilter" + "#excludes"; final String excludeParam = webConfig.getInitParameter(deprecatedName) != null ? webConfig.getInitParameter(deprecatedName) : webConfig.getInitParameter(PARAM_EXTENSION_FILTER_EXCLUDES); final String[] excludes = StringUtils.split(excludeParam, " ,;"); final DefaultResourceConfig resourceConfig = resourceConfigManager.createResourceConfig(props, excludes, restApiContext.getPackages()); restApiContext.setConfig(resourceConfig); return resourceConfig; }
private ResourceConfig createResourceConfig(WebConfig webConfig, Map<String, Object> props) throws ServletException { String resourceConfigClassName = webConfig.getInitParameter(RESOURCE_CONFIG_CLASS); resourceConfigClassName = webConfig.getInitParameter(APPLICATION_CONFIG_CLASS); String packages = webConfig.getInitParameter( PackagesResourceConfig.PROPERTY_PACKAGES); if (packages != null) { ResourceConfig defaultConfig = webConfig.getDefaultResourceConfig(props); if (defaultConfig != null) return defaultConfig; String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths); Constructor constructor = resourceConfigClass.getConstructor(Map.class); if (ClasspathResourceConfig.class.isAssignableFrom(resourceConfigClass)) { String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
/** * Get the application context. * <p> * If the initialization parameter {@link #CONTEXT_CONFIG_LOCATION} * is present then this method will invoke {@link #getChildContext(java.lang.String) } * otherwise this method will invoke {@link #getDefaultContext() }. * * @return the application context. */ protected ConfigurableApplicationContext getContext() { final String contextConfigLocation = getWebConfig().getInitParameter(CONTEXT_CONFIG_LOCATION); if (contextConfigLocation == null) { LOGGER.info("Using default applicationContext"); return getDefaultContext(); } else { LOGGER.info("Creating new child context from " + contextConfigLocation); return getChildContext(contextConfigLocation); } }
private Map<String, Object> getInitParams(WebConfig webConfig) { Map<String, Object> props = new HashMap<String, Object>(); Enumeration names = webConfig.getInitParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); props.put(name, webConfig.getInitParameter(name)); } return props; }
private ResourceConfig createResourceConfig(WebConfig webConfig, Map<String, Object> props) throws ServletException { String resourceConfigClassName = webConfig.getInitParameter(RESOURCE_CONFIG_CLASS); resourceConfigClassName = webConfig.getInitParameter(APPLICATION_CONFIG_CLASS); String packages = webConfig.getInitParameter( PackagesResourceConfig.PROPERTY_PACKAGES); if (packages != null) { ResourceConfig defaultConfig = webConfig.getDefaultResourceConfig(props); if (defaultConfig != null) return defaultConfig; String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths); Constructor constructor = resourceConfigClass.getConstructor(Map.class); if (ClasspathResourceConfig.class.isAssignableFrom(resourceConfigClass)) { String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
/* package */ ResourceConfig getWebAppResourceConfig(Map<String, Object> props, WebConfig webConfig) throws ServletException { // Default to using Web app resource config return new WebAppResourceConfig(props, webConfig.getServletContext()); }
private Map<String, Object> getInitParams(WebConfig webConfig) { Map<String, Object> props = new HashMap<String, Object>(); Enumeration names = webConfig.getInitParameterNames(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); props.put(name, webConfig.getInitParameter(name)); } return props; }
/* package */ ResourceConfig getWebAppResourceConfig(Map<String, Object> props, WebConfig webConfig) throws ServletException { // Default to using Web app resource config return new WebAppResourceConfig(props, webConfig.getServletContext()); }
public static void initialize(WebConfig wc, ResourceConfig rc, WebApplication wa) { ServletContext sc = wc.getServletContext(); Object beanManager = lookup(sc); if (beanManager == null) { LOGGER.config("The CDI BeanManager is not available. JAX-RS CDI support is disabled."); return; } rc.getSingletons().add(new CDIComponentProviderFactory(beanManager, rc, wa)); LOGGER.info("CDI support is enabled"); }
public static void initialize(WebConfig wc, ResourceConfig rc, WebApplication wa) { ServletContext sc = wc.getServletContext(); Object beanManager = lookup(sc); if (beanManager == null) { LOGGER.config("The CDI BeanManager is not available. JAX-RS CDI support is disabled."); return; } rc.getSingletons().add(new CDIComponentProviderFactory(beanManager, rc, wa)); LOGGER.info("CDI support is enabled"); }
public static void initialize(WebConfig wc, ResourceConfig rc, WebApplication wa) { ServletContext sc = wc.getServletContext(); Object beanManager = lookup(sc); if (beanManager == null) { LOGGER.config("The CDI BeanManager is not available. JAX-RS CDI support is disabled."); return; } rc.getSingletons().add(new CDIComponentProviderFactory(beanManager, rc, wa)); LOGGER.info("CDI support is enabled"); }
private String[] getPaths(String classpath) throws ServletException { final ServletContext context = config.getServletContext(); if (classpath == null) { String[] paths = {
private String[] getPaths(String classpath) throws ServletException { final ServletContext context = config.getServletContext(); if (classpath == null) { String[] paths = {
private String[] getPaths(String classpath) throws ServletException { final ServletContext context = config.getServletContext(); if (classpath == null) { String[] paths = {