Search in sources :

Example 1 with WebApplicationDeclaredRoles

use of org.everrest.core.tools.WebApplicationDeclaredRoles 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

ServletContext (javax.servlet.ServletContext)1 DeploymentException (javax.websocket.DeploymentException)1 ServerContainer (javax.websocket.server.ServerContainer)1 EverrestConfiguration (org.everrest.core.impl.EverrestConfiguration)1 WebApplicationDeclaredRoles (org.everrest.core.tools.WebApplicationDeclaredRoles)1