public void init(FilterConfig config) throws ServletException { this.config = config; this.graniteConfig = ServletGraniteConfig.loadConfig(config.getServletContext()); this.servicesConfig = ServletServicesConfig.loadConfig(config.getServletContext()); closeStreams = ServletParams.get(config, "closeStreams", Boolean.TYPE, true); inputBufferSize = ServletParams.get(config, "inputBufferSize", Integer.TYPE, null); outputBufferSize = ServletParams.get(config, "outputBufferSize", Integer.TYPE, null); if (inputBufferSize != null && inputBufferSize <= 0) throw new ServletException("Illegal value for inputBufferSize=" + inputBufferSize + " (should be > 0, fix your web.xml)"); if (outputBufferSize != null && outputBufferSize <= 0) throw new ServletException("Illegal value for outputBufferSize=" + outputBufferSize + " (should be > 0, fix your web.xml)"); log.info("Using configuration: {closeStreams=%s, inputBufferSize=%s, outputBufferSize=%s}", closeStreams, inputBufferSize, outputBufferSize); jmfSharedContext = GraniteConfigListener.getSharedContext(config.getServletContext()); }
public synchronized void reload() { if (context == null) throw new IllegalStateException("GraniteConfig was not registered in ServletContext"); ServletGraniteConfig oldConfig = (ServletGraniteConfig)context.getAttribute(GRANITE_CONFIG_KEY); try { context.removeAttribute(GRANITE_CONFIG_KEY); ServletGraniteContext.createThreadInstance(null, null, context, (String)null, null); GraniteConfig config = loadConfig(context); for (GraniteConfigReloadListener listener : reloadListeners) { try { listener.onReload(context, config); } catch (Exception e) { log.error(e, "Error while calling reload listener: %s", listener); } } } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } finally { GraniteContext.release(); if (context.getAttribute(GRANITE_CONFIG_KEY) == null) context.setAttribute(GRANITE_CONFIG_KEY, oldConfig); } }
GraniteConfig graniteConfig = ServletGraniteConfig.loadConfig(context); ServicesConfig servicesConfig = new ServicesConfig(is, configuration, skipScan ? false : graniteConfig.getScan());
servletGraniteConfig = loadConfig(context, graniteConfig);
serviceConfigurator.initialize(context); GraniteConfig gConfig = ServletGraniteConfig.loadConfig(context);
protected void init(ServletContext servletContext, String configPath) throws IOException, SAXException { String path = configuration.getGraniteConfig(); if (path == null) path = GRANITE_CONFIG_DEFAULT; InputStream is = servletContext.getResourceAsStream(path); if (is == null) { log.warn("Could not load custom granite-config.xml: %s (file does not exists)", path); path = null; } this.graniteConfig = new GraniteConfig(configPath, is, null, null); ServletGraniteConfig.loadConfig(servletContext, graniteConfig); path = configuration.getFlexServicesConfig(); if (path == null) path = SERVICES_CONFIG_DEFAULT; is = servletContext.getResourceAsStream(path); if (is == null) { log.warn("Could not load custom services-config.xml: %s (file does not exists)", path); path = null; } this.servicesConfig = new ServicesConfig(is, null, false); ServletServicesConfig.loadConfig(servletContext, servicesConfig); }
GraniteConfig graniteConfig = ServletGraniteConfig.loadConfig(context); graniteConfig.setSharedContext(GraniteConfigListener.getSharedContext(context));
public void configureServices(ServletContext servletContext) throws ServletException { GraniteConfig graniteConfig = ServletGraniteConfig.loadConfig(servletContext); ServicesConfig servicesConfig = ServletServicesConfig.loadConfig(servletContext, true);