Search in sources :

Example 1 with ListenerBootstrap

use of org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap in project resteasy by resteasy.

the class ContextParameterInjectionTest method createProxy.

private Object createProxy() {
    ServletContext mockServletContext = mock(ServletContext.class);
    when(mockServletContext.getAttribute(ResteasyDeployment.class.getName())).thenReturn(null);
    ConfigurationBootstrap configBootstrap = new ListenerBootstrap(mockServletContext);
    ResteasyContext.pushContext(ResteasyDeployment.class, configBootstrap.createDeployment());
    try {
        final Class<ContainerRequestFilter> filterClass = ContainerRequestFilter.class;
        final ContainerRequestFilter coolInstance = new CoolFilter();
        ResteasyProviderFactory mockFactory = mock(ResteasyProviderFactory.class);
        when(mockFactory.getContextData(filterClass, filterClass, null, false)).thenReturn(coolInstance);
        ResteasyProviderFactory.setInstance(mockFactory);
        ContextParameterInjector cpi = new ContextParameterInjector(null, filterClass, filterClass, null, mockFactory);
        return cpi.createProxy();
    } finally {
        ResteasyContext.removeContextDataLevel();
    }
}
Also used : ResteasyDeployment(org.jboss.resteasy.spi.ResteasyDeployment) ListenerBootstrap(org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap) ContainerRequestFilter(jakarta.ws.rs.container.ContainerRequestFilter) ServletContext(jakarta.servlet.ServletContext) ConfigurationBootstrap(org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap) ResteasyProviderFactory(org.jboss.resteasy.spi.ResteasyProviderFactory)

Example 2 with ListenerBootstrap

use of org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap in project brave by openzipkin.

the class TracingBootstrap method contextInitialized.

@Override
public void contextInitialized(ServletContextEvent event) {
    ServletContext servletContext = event.getServletContext();
    ListenerBootstrap config = new ListenerBootstrap(servletContext);
    servletContext.setAttribute(ResteasyDeployment.class.getName(), deployment);
    deployment.getDefaultContextObjects().put(ResteasyConfiguration.class, config);
    config.createDeployment();
    deployment.start();
}
Also used : ResteasyDeployment(org.jboss.resteasy.spi.ResteasyDeployment) ListenerBootstrap(org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap) ServletContext(javax.servlet.ServletContext)

Example 3 with ListenerBootstrap

use of org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap in project scm-manager by scm-manager.

the class ResteasyAllInOneServletDispatcher method createDeployment.

private ResteasyDeployment createDeployment(ServletContext servletContext) {
    ListenerBootstrap config = new ListenerBootstrap(servletContext);
    ResteasyDeployment deployment = config.createDeployment();
    deployment.start();
    servletContext.setAttribute(ResteasyDeployment.class.getName(), deployment);
    return deployment;
}
Also used : ResteasyDeployment(org.jboss.resteasy.spi.ResteasyDeployment) ListenerBootstrap(org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap)

Aggregations

ListenerBootstrap (org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap)3 ResteasyDeployment (org.jboss.resteasy.spi.ResteasyDeployment)3 ServletContext (jakarta.servlet.ServletContext)1 ContainerRequestFilter (jakarta.ws.rs.container.ContainerRequestFilter)1 ServletContext (javax.servlet.ServletContext)1 ConfigurationBootstrap (org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap)1 ResteasyProviderFactory (org.jboss.resteasy.spi.ResteasyProviderFactory)1