Search in sources :

Example 6 with EverrestConfiguration

use of org.everrest.core.impl.EverrestConfiguration in project che by eclipse.

the class ServerContainerInitializeListener method getEverrestProcessor.

protected EverrestProcessor getEverrestProcessor(ServletContext servletContext) {
    final DependencySupplier dependencies = (DependencySupplier) servletContext.getAttribute(DependencySupplier.class.getName());
    final ResourceBinder resources = (ResourceBinder) servletContext.getAttribute(ResourceBinder.class.getName());
    final ProviderBinder providers = (ProviderBinder) servletContext.getAttribute(ApplicationProviderBinder.class.getName());
    final EverrestConfiguration copyOfEverrestConfiguration = new EverrestConfiguration(getEverrestConfiguration(servletContext));
    copyOfEverrestConfiguration.setProperty(EverrestConfiguration.METHOD_INVOKER_DECORATOR_FACTORY, WebSocketMethodInvokerDecoratorFactory.class.getName());
    final RequestHandlerImpl requestHandler = new RequestHandlerImpl(new RequestDispatcher(resources), providers);
    return new EverrestProcessor(copyOfEverrestConfiguration, dependencies, requestHandler, null);
}
Also used : ApplicationProviderBinder(org.everrest.core.impl.ApplicationProviderBinder) ProviderBinder(org.everrest.core.impl.ProviderBinder) EverrestConfiguration(org.everrest.core.impl.EverrestConfiguration) DependencySupplier(org.everrest.core.DependencySupplier) RequestHandlerImpl(org.everrest.core.impl.RequestHandlerImpl) ResourceBinder(org.everrest.core.ResourceBinder) EverrestProcessor(org.everrest.core.impl.EverrestProcessor) RequestDispatcher(org.everrest.core.impl.RequestDispatcher)

Example 7 with EverrestConfiguration

use of org.everrest.core.impl.EverrestConfiguration in project che by eclipse.

the class ServerContainerInitializeListener method contextInitialized.

@Override
public final void contextInitialized(ServletContextEvent sce) {
    final ServletContext servletContext = sce.getServletContext();
    websocketContext = MoreObjects.firstNonNull(servletContext.getInitParameter("org.everrest.websocket.context"), "");
    websocketEndPoint = MoreObjects.firstNonNull(servletContext.getInitParameter("org.eclipse.che.websocket.endpoint"), "");
    eventBusEndPoint = MoreObjects.firstNonNull(servletContext.getInitParameter("org.eclipse.che.eventbus.endpoint"), "");
    webApplicationDeclaredRoles = new WebApplicationDeclaredRoles(servletContext);
    everrestConfiguration = (EverrestConfiguration) servletContext.getAttribute(EVERREST_CONFIG_ATTRIBUTE);
    if (everrestConfiguration == null) {
        everrestConfiguration = new EverrestConfiguration();
    }
    final ServerContainer serverContainer = (ServerContainer) servletContext.getAttribute("javax.websocket.server.ServerContainer");
    try {
        wsServerEndpointConfig = createWsServerEndpointConfig(servletContext);
        eventbusServerEndpointConfig = createEventbusServerEndpointConfig(servletContext);
        serverContainer.addEndpoint(wsServerEndpointConfig);
        serverContainer.addEndpoint(eventbusServerEndpointConfig);
    } catch (DeploymentException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}
Also used : WebApplicationDeclaredRoles(org.everrest.core.tools.WebApplicationDeclaredRoles) EverrestConfiguration(org.everrest.core.impl.EverrestConfiguration) ServletContext(javax.servlet.ServletContext) DeploymentException(javax.websocket.DeploymentException) ServerContainer(javax.websocket.server.ServerContainer)

Aggregations

EverrestConfiguration (org.everrest.core.impl.EverrestConfiguration)7 EverrestProcessor (org.everrest.core.impl.EverrestProcessor)5 RequestDispatcher (org.everrest.core.impl.RequestDispatcher)5 RequestHandlerImpl (org.everrest.core.impl.RequestHandlerImpl)5 ApplicationProviderBinder (org.everrest.core.impl.ApplicationProviderBinder)4 ResourceBinderImpl (org.everrest.core.impl.ResourceBinderImpl)4 DependencySupplierImpl (org.everrest.core.tools.DependencySupplierImpl)4 ResourceLauncher (org.everrest.core.tools.ResourceLauncher)4 ResourceBinder (org.everrest.core.ResourceBinder)3 ProviderBinder (org.everrest.core.impl.ProviderBinder)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 URI (java.net.URI)2 ApplicationContext (org.everrest.core.ApplicationContext)2 ApplicationContext.anApplicationContext (org.everrest.core.ApplicationContext.anApplicationContext)2 ContainerRequest (org.everrest.core.impl.ContainerRequest)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 File (java.io.File)1 PathMatcher (java.nio.file.PathMatcher)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1