Package com.noelios.restlet.component

Examples of com.noelios.restlet.component.ComponentContext


        // Add the WAR client
        component.getClients().add(
                createWarClient(component.getContext(), getServletConfig()));

        // Copy all the servlet parameters into the context
        final ComponentContext componentContext = (ComponentContext) component
                .getContext();
        String initParam;

        // Copy all the Servlet container initialization parameters
        final javax.servlet.ServletConfig servletConfig = getServletConfig();
        for (final Enumeration<String> enum1 = servletConfig
                .getInitParameterNames(); enum1.hasMoreElements();) {
            initParam = enum1.nextElement();
            componentContext.getParameters().add(initParam,
                    servletConfig.getInitParameter(initParam));
        }

        // Copy all the Servlet application initialization parameters
        for (final Enumeration<String> enum1 = getServletContext()
                .getInitParameterNames(); enum1.hasMoreElements();) {
            initParam = enum1.nextElement();
            componentContext.getParameters().add(initParam,
                    getServletContext().getInitParameter(initParam));
        }

        // Copy all Servlet's context attributes
        String attributeName;
        for (final Enumeration<String> namesEnum = getServletContext()
                .getAttributeNames(); namesEnum.hasMoreElements();) {
            attributeName = namesEnum.nextElement();
            componentContext.getAttributes().put(attributeName,
                    getServletContext().getAttribute(attributeName));
        }

        return component;
    }
View Full Code Here


        // Add the WAR client
        component.getClients().add(
                createWarClient(component.getContext(), getServletConfig()));

        // Copy all the servlet parameters into the context
        final ComponentContext componentContext = (ComponentContext) component
                .getContext();
        String initParam;

        // Copy all the Servlet container initialization parameters
        final javax.servlet.ServletConfig servletConfig = getServletConfig();
        for (final Enumeration<String> enum1 = servletConfig
                .getInitParameterNames(); enum1.hasMoreElements();) {
            initParam = enum1.nextElement();
            componentContext.getParameters().add(initParam,
                    servletConfig.getInitParameter(initParam));
        }

        // Copy all the Servlet application initialization parameters
        for (final Enumeration<String> enum1 = getServletContext()
                .getInitParameterNames(); enum1.hasMoreElements();) {
            initParam = enum1.nextElement();
            componentContext.getParameters().add(initParam,
                    getServletContext().getInitParameter(initParam));
        }

        // Copy all Servlet's context attributes
        String attributeName;
        for (final Enumeration<String> namesEnum = getServletContext()
                .getAttributeNames(); namesEnum.hasMoreElements();) {
            attributeName = namesEnum.nextElement();
            componentContext.getAttributes().put(attributeName,
                    getServletContext().getAttribute(attributeName));
        }

        return component;
    }
View Full Code Here

TOP

Related Classes of com.noelios.restlet.component.ComponentContext

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.