Package org.apache.wink.server.internal

Examples of org.apache.wink.server.internal.DeploymentConfiguration


import org.apache.wink.test.mock.SpringAwareTestCase;

public class PropertiesOverrideTest extends SpringAwareTestCase {

    public void testPropertiesOverride() throws Exception {
        DeploymentConfiguration configuration =
            (DeploymentConfiguration)applicationContext
                .getBean("winkInternalDeploymentConfiguration");
        Properties properties = configuration.getProperties();

        // check custom
        assertEquals("atom", properties.getProperty("wink.searchPolicyContinuedSearch"));
        assertEquals("test me", properties.getProperty("test.property"));
View Full Code Here


        @Override
        protected DeploymentConfiguration getDeploymentConfiguration()
            throws ClassNotFoundException, InstantiationException, IllegalAccessException,
            IOException {
            DeploymentConfiguration deploymentConfiguration = super.getDeploymentConfiguration();
            deploymentConfiguration.setFilterConfig(filterConfig);
            return deploymentConfiguration;
        }
View Full Code Here

        getRequestProcessor().handleRequest(httpServletRequest, httpServletResponse);
    }

    protected RequestProcessor createRequestProcessor() throws ClassNotFoundException,
        InstantiationException, IllegalAccessException, IOException {
        DeploymentConfiguration deploymentConfiguration = getDeploymentConfiguration();
        // order of next two lines is important to allow Application to have
        // control over priority order of Providers
        Application app = getApplication();
        if (app == null) {
            app = getApplication(deploymentConfiguration);
        }
        if (logger.isTraceEnabled()) {
            logger.trace("Setting application to " + app.toString());
        }
        deploymentConfiguration.addApplication(app, false);

        if (!LoggerFactory.getLogger(Resources.class).isTraceEnabled()) {
            /*
             * if just debug or higher is enabled, then log only user
             * applications
             */
            new Resources(deploymentConfiguration.getResourceRegistry()).log();
        }

        if (!LoggerFactory.getLogger(Providers.class).isTraceEnabled()) {
            /*
             * if just debug or higher is enabled, then log only user
             * applications
             */
            new Providers(deploymentConfiguration.getProvidersRegistry()).log();
        }

        RequestProcessor requestProcessor = new RequestProcessor(deploymentConfiguration);
        logger.trace("Creating request processor {} for servlet {}", requestProcessor, this); //$NON-NLS-1$

        if (LoggerFactory.getLogger(Resources.class).isTraceEnabled()) {
            /*
             * if full trace is enabled, then log everything
             */

            new Resources(deploymentConfiguration.getResourceRegistry()).log();
        }

        if (LoggerFactory.getLogger(Providers.class).isTraceEnabled()) {
            /*
             * if full trace is enabled, then log everything
             */
            new Providers(deploymentConfiguration.getProvidersRegistry()).log();
        }

        return requestProcessor;
    }
View Full Code Here

        return requestProcessor;
    }

    protected DeploymentConfiguration getDeploymentConfiguration() throws ClassNotFoundException,
        InstantiationException, IllegalAccessException, IOException {
        DeploymentConfiguration deploymentConfiguration = createDeploymentConfiguration();
        deploymentConfiguration.setServletConfig(getServletConfig());
        deploymentConfiguration.setServletContext(getServletContext());
        deploymentConfiguration.setProperties(getProperties());
        deploymentConfiguration.init();
        return deploymentConfiguration;
    }
View Full Code Here

            // use ClassUtils.loadClass instead of Class.forName so we have
            // classloader visibility into the Web module in J2EE environments
            Class<?> confClass = ClassUtils.loadClass(initParameter);
            return (DeploymentConfiguration)confClass.newInstance();
        }
        return new DeploymentConfiguration();
    }
View Full Code Here

    }

    @Override
    public DeploymentConfiguration getDeploymentConfiguration() throws ClassNotFoundException, InstantiationException,
        IllegalAccessException, IOException {
        DeploymentConfiguration config = super.getDeploymentConfiguration();

        // [rfeng] FIXME: This is a hack to fool Apache wink to not remove the servlet path
        config.setFilterConfig(new FilterConfig() {

            public ServletContext getServletContext() {
                return getServletContext();
            }

            public Enumeration getInitParameterNames() {
                return getInitParameterNames();
            }

            public String getInitParameter(String arg0) {
                return getInitParameter(arg0);
            }

            public String getFilterName() {
                return getServletName();
            }
        });

        ProvidersRegistry providers = config.getProvidersRegistry();
        providers.addProvider(new DataBindingJAXRSReader(registry), 0.001, true);
        providers.addProvider(new DataBindingJAXRSWriter(registry), 0.001, true);

        return config;
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.server.internal.DeploymentConfiguration

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.