Search in sources :

Example 1 with VoidServletConfig

use of org.atmosphere.util.VoidServletConfig in project cxf by apache.

the class AtmosphereWebSocketJettyDestination method activate.

protected void activate() {
    super.activate();
    if (handler.getServletContext().getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") == null) {
        try {
            Class<?> dcc = ClassUtils.forName("org.eclipse.jetty.util.DecoratedObjectFactory", getClass().getClassLoader());
            handler.getServletContext().setAttribute("org.eclipse.jetty.util.DecoratedObjectFactory", dcc.newInstance());
        } catch (ClassNotFoundException | LinkageError | InstantiationException | IllegalAccessException e) {
        // ignore, old version of Jetty
        }
    }
    ServletConfig config = new VoidServletConfig(initParams) {

        @Override
        public ServletContext getServletContext() {
            return handler.getServletContext();
        }
    };
    try {
        framework.init(config);
    } catch (ServletException e) {
        throw new Fault(new Message("Could not initialize WebSocket Framework", LOG, e.getMessage()), e);
    }
}
Also used : ServletException(javax.servlet.ServletException) VoidServletConfig(org.atmosphere.util.VoidServletConfig) Message(org.apache.cxf.common.i18n.Message) ServletConfig(javax.servlet.ServletConfig) VoidServletConfig(org.atmosphere.util.VoidServletConfig) Fault(org.apache.cxf.interceptor.Fault)

Aggregations

ServletConfig (javax.servlet.ServletConfig)1 ServletException (javax.servlet.ServletException)1 Message (org.apache.cxf.common.i18n.Message)1 Fault (org.apache.cxf.interceptor.Fault)1 VoidServletConfig (org.atmosphere.util.VoidServletConfig)1