Package org.apache.cocoon.configuration

Examples of org.apache.cocoon.configuration.Settings


                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


        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

     * 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

        this.logRequest(request);

        this.lazyInitialize(this.servletConfig);

        try {
            Settings settings = (Settings) this.beanFactory.getBean(Settings.class.getName());

            SitemapDelegator.setSitemapServlet(this);
            MimeTypeCollector.clearMimeType();
            StatusCodeCollector.clearStatusCode();
            LastModifiedCollector.clearLastModified();

            // assemble parameters
            Map<String, Object> parameters = this.getInvocationParameters(request);
            HttpContextHelper.storeRequest(request, parameters);
            HttpContextHelper.storeResponse(response, parameters);
            HttpContextHelper.storeServletContext(this.getServletContext(), parameters);
            SettingsHelper.storeSettings(settings, parameters);

            // invoke the sitemap engine
            ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
            this.invoke(this.calcSitemapRequestURI(request), parameters, baos);

            // collect meta information from the previous run of the sitemap engine
            long lastModified = LastModifiedCollector.getLastModified();
            String mimeType = MimeTypeCollector.getMimeType();
            int contentLengh = baos.size();
            int statusCode = StatusCodeCollector.getStatusCode();

            // send the Last-Modified header
            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);
            }

            // conditional request support
            long ifLastModifiedSince = request.getDateHeader("If-Modified-Since");
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

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.