Package org.apache.cocoon.configuration

Examples of org.apache.cocoon.configuration.Settings


    /**
     * Get the current settings object for java script.
     */
    public Scriptable jsGet_settings() {
        final Settings s = this.getSettings();
        return org.mozilla.javascript.Context.toObject(s, getParentScope());
    }
View Full Code Here


     * Create a new settings object.
     * If a parent settings object is available a new child settings object is created.
     * Otherwise a new root settings object with the running mode is instantiated.
     */
    protected MutableSettings createMutableSettingsInstance() {
        final Settings parentSettings = getParentSettings();
        if (parentSettings == null) {
            return new MutableSettings(getRunningMode());
        }

        return new MutableSettings(parentSettings);
View Full Code Here

        return parameters;
    }

    private void sendSitemapResponse(HttpServletRequest request, HttpServletResponse response) throws IOException {
        Settings settings = (Settings) this.beanFactory.getBean(Settings.class.getName());

        // provide conditional GET relevant data and request method
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        // read the 'If-Modified-Since' request header
        long ifModifiedSince = request.getDateHeader("If-Modified-Since");
        ResponseHeaderCollector.setIfLastModifiedSince(ifModifiedSince);

        // read the 'If-None-Match' request header
        String ifNoneMatch = request.getHeader("If-None-Match");
        ResponseHeaderCollector.setIfNoneMatch(ifNoneMatch);

        // request method
        ResponseHeaderCollector.setRequestMethod(request.getMethod());

        // invoke the sitemap engine
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
        this.invoke(this.calcSitemapRequestURI(request), prepareParameters(request, response, settings,
                this.servletContext), baos);

        // read data after sitemap/pipeline execution
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        // read the produced status code
        int statusCode = ResponseHeaderCollector.getStatusCode();

        // collect meta information from the previous exeuction of the sitemap engine
        long lastModified = ResponseHeaderCollector.getLastModified();
        String etag = ResponseHeaderCollector.getETag();

        // set response headers
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        if (statusCode >= 200 && statusCode < 300) {
            // send the ETag header
            if (etag != null && !"".equals(etag)) {
                response.setHeader("ETag", etag);
            }
            // send the Last-Modified
            if (lastModified > -1) {
                response.setDateHeader("Last-Modified", lastModified);
            }
        }

        // set the X-Cocoon-Version header
        if (!"false".equals(settings.getProperty("org.apache.cocoon.show-version"))) {
            response.setHeader("X-Cocoon-Version", this.version);
        }

        // Content-Type handling
        String mimeType = ResponseHeaderCollector.getMimeType();
View Full Code Here

                field.set(controller, response.getOutputStream());
            } else if (fieldType == ServletContext.class) {
                ServletContext servletContext = HttpContextHelper.getServletContext(parameters);
                field.set(controller, servletContext);
            } else if (fieldType == Settings.class) {
                Settings settings = SettingsHelper.getSettings(parameters);
                field.set(controller, settings);
            } else {
                throw new Exception("The annotation " + Inject.class.getName()
                        + " doesn't support the injection of type " + fieldType.getName() + "." + " " + "(field="
                        + field.getName() + ", type=" + fieldType.getName() + ")");
View Full Code Here

        addValue("size", size + " items in cache (" + empty + " are empty)");
        endGroup();
    }

    private void genSettings() throws SAXException {
        final Settings s = this.settings;
        this.startGroup("Base Settings");

        this.addValue("Running mode", s.getRunningMode());
        this.addMultilineValue(Settings.KEY_LOAD_CLASSES, s.getLoadClasses());
        this.addValue(Settings.KEY_CACHE_DIRECTORY, s.getCacheDirectory());
        this.addValue(Settings.KEY_WORK_DIRECTORY, s.getWorkDirectory());
        this.addValue(Settings.KEY_FORM_ENCODING, s.getFormEncoding());
        this.addValue(Settings.KEY_CONTAINER_ENCODING, s.getContainerEncoding());

        this.endGroup();

        this.startGroup("Dynamic Settings");

        this.addValue(Settings.KEY_RELOADING, s.isReloadingEnabled(null));
        this.addValue(Settings.KEY_RELOAD_DELAY, s.getReloadDelay(null));
        Iterator i = s.getPropertyNames("org.apache.cocoon." + Settings.KEY_RELOADING + '.').iterator();
        while ( i.hasNext() ) {
            final String key = (String)i.next();
            final String value = s.getProperty(key);
            this.addValue(key.substring(18), value);
        }
        i = s.getPropertyNames("org.apache.cocoon." + Settings.KEY_RELOAD_DELAY + '.').iterator();
        while ( i.hasNext() ) {
            final String key = (String)i.next();
            final String value = s.getProperty(key);
            this.addValue(key.substring(18), value);
        }

        this.endGroup();
    }
View Full Code Here

     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
     *
     * @deprecated use property injection instead
     */
    public void service(ServiceManager manager) throws ServiceException {
        final Settings settings = (Settings)manager.lookup(Settings.ROLE);
        String defaultEncoding  = settings.getFormEncoding();
        if (defaultEncoding != null) {
            this.format.setProperty(OutputKeys.ENCODING, defaultEncoding);
        }
        manager.release(settings);
    }
View Full Code Here

     */
    public void setBuilder(TreeBuilder treeBuilder) {
        super.setBuilder(treeBuilder);
        // check ssettings for ignoring of internal only pipeline flags
        this.ignoreInternalOnly = false;
        final Settings settings = (Settings)treeBuilder.getWebApplicationContext().getBean(Settings.ROLE);
        final String value = settings.getProperty(PipelineNodeBuilder.PROPERTY_SITEMAP_INTERNALONLY);
        if ( value != null ) {
            this.ignoreInternalOnly = Boolean.valueOf(value).booleanValue();
        }
    }
View Full Code Here

    protected boolean hasParameters() {
        return false;
    }

    public ProcessingNode buildNode(Configuration config) throws Exception {
        final Settings settings = (Settings)manager.lookup(Settings.ROLE);
        MountNode node = new MountNode(
            VariableResolverFactory.getResolver(config.getAttribute("uri-prefix"), manager),
            VariableResolverFactory.getResolver(config.getAttribute("src"), manager),
            this.treeBuilder.getProcessor().getWrappingProcessor(),
            config.getAttributeAsBoolean("check-reload", settings.isReloadingEnabled("sitemap")),
            config.getAttributeAsBoolean("pass-through", false)
        );
 
        return (this.treeBuilder.setupNode(node, config));
    }
View Full Code Here

    /**
     * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
     */
    public Object getAttribute(String name, Configuration modeConf, Map objectModel)
    throws ConfigurationException {
        final Settings settings = (Settings)WebAppContextUtils.getCurrentWebApplicationContext().getBean(Settings.ROLE);
        return settings.getProperty(name);
    }
View Full Code Here

    /**
     * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration, java.util.Map)
     */
    public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
    throws ConfigurationException {
        final Settings settings = (Settings)WebAppContextUtils.getCurrentWebApplicationContext().getBean(Settings.ROLE);
        return settings.getPropertyNames().iterator();
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.configuration.Settings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.