Search in sources :

Example 1 with CXFServlet

use of org.apache.cxf.transport.servlet.CXFServlet in project opennms by OpenNMS.

the class AbstractSpringJerseyRestTestCase method setUp.

@Before
public void setUp() throws Throwable {
    beforeServletStart();
    setUser("admin", new String[] { "ROLE_ADMIN" });
    DaoTestConfigBean bean = new DaoTestConfigBean();
    bean.afterPropertiesSet();
    MockDatabase db = new MockDatabase(true);
    DataSourceFactory.setInstance(db);
    XADataSourceFactory.setInstance(db);
    try {
        MockFilterConfig filterConfig = new MockFilterConfig(servletContext, "openSessionInViewFilter");
        setFilter(new OpenSessionInViewFilter());
        getFilter().init(filterConfig);
        // Jersey
        /*
            setServletConfig(new MockServletConfig(servletContext, "dispatcher"));
            getServletConfig().addInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig");
            getServletConfig().addInitParameter("com.sun.jersey.config.property.packages", "org.codehaus.jackson.jaxrs;org.opennms.web.rest;org.opennms.web.rest.config");
            getServletConfig().addInitParameter("com.sun.jersey.spi.container.ContainerRequestFilters", "com.sun.jersey.api.container.filter.GZIPContentEncodingFilter");
            getServletConfig().addInitParameter("com.sun.jersey.spi.container.ContainerResponseFilters", "com.sun.jersey.api.container.filter.GZIPContentEncodingFilter");
            setDispatcher(new SpringServlet());
            getDispatcher().init(getServletConfig());
            */
        // Apache CXF
        setServletConfig(new MockServletConfig(servletContext, "dispatcher"));
        getServletConfig().addInitParameter("config-location", m_cxfContextPath);
        CXFServlet servlet = new CXFServlet();
        setDispatcher(servlet);
        getDispatcher().init(getServletConfig());
    } catch (ServletException se) {
        throw se.getRootCause();
    }
    afterServletStart();
    System.err.println("------------------------------------------------------------------------------");
}
Also used : DaoTestConfigBean(org.opennms.test.DaoTestConfigBean) OpenSessionInViewFilter(org.springframework.orm.hibernate3.support.OpenSessionInViewFilter) ServletException(javax.servlet.ServletException) MockDatabase(org.opennms.core.test.db.MockDatabase) MockServletConfig(org.springframework.mock.web.MockServletConfig) CXFServlet(org.apache.cxf.transport.servlet.CXFServlet) MockFilterConfig(org.springframework.mock.web.MockFilterConfig) Before(org.junit.Before)

Example 2 with CXFServlet

use of org.apache.cxf.transport.servlet.CXFServlet in project cas by apereo.

the class CoreWsSecuritySecurityTokenServiceConfiguration method cxfServlet.

@Bean
public ServletRegistrationBean cxfServlet() {
    final ServletRegistrationBean bean = new ServletRegistrationBean();
    bean.setEnabled(true);
    bean.setName("cxfServletSecurityTokenService");
    bean.setServlet(new CXFServlet());
    bean.setUrlMappings(Collections.singleton(WSFederationConstants.ENDPOINT_STS.concat("*")));
    bean.setAsyncSupported(true);
    return bean;
}
Also used : ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) CXFServlet(org.apache.cxf.transport.servlet.CXFServlet) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) STSPropertiesMBean(org.apache.cxf.sts.STSPropertiesMBean) ServletRegistrationBean(org.springframework.boot.web.servlet.ServletRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

CXFServlet (org.apache.cxf.transport.servlet.CXFServlet)2 ServletException (javax.servlet.ServletException)1 STSPropertiesMBean (org.apache.cxf.sts.STSPropertiesMBean)1 Before (org.junit.Before)1 MockDatabase (org.opennms.core.test.db.MockDatabase)1 DaoTestConfigBean (org.opennms.test.DaoTestConfigBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)1 Bean (org.springframework.context.annotation.Bean)1 MockFilterConfig (org.springframework.mock.web.MockFilterConfig)1 MockServletConfig (org.springframework.mock.web.MockServletConfig)1 OpenSessionInViewFilter (org.springframework.orm.hibernate3.support.OpenSessionInViewFilter)1