Search in sources :

Example 1 with CXFNonSpringJaxrsServlet

use of org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet in project zeppelin by apache.

the class ZeppelinServer method setupRestApiContextHandler.

private static void setupRestApiContextHandler(WebAppContext webapp, ZeppelinConfiguration conf) {
    final ServletHolder cxfServletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
    cxfServletHolder.setInitParameter("javax.ws.rs.Application", ZeppelinServer.class.getName());
    cxfServletHolder.setName("rest");
    cxfServletHolder.setForcedPath("rest");
    webapp.setSessionHandler(new SessionHandler());
    webapp.addServlet(cxfServletHolder, "/api/*");
    String shiroIniPath = conf.getShiroPath();
    if (!StringUtils.isBlank(shiroIniPath)) {
        webapp.setInitParameter("shiroConfigLocations", new File(shiroIniPath).toURI().toString());
        SecurityUtils.initSecurityManager(shiroIniPath);
        webapp.addFilter(ShiroFilter.class, "/api/*", EnumSet.allOf(DispatcherType.class));
        webapp.addEventListener(new EnvironmentLoaderListener());
    }
}
Also used : SessionHandler(org.eclipse.jetty.server.session.SessionHandler) EnvironmentLoaderListener(org.apache.shiro.web.env.EnvironmentLoaderListener) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) DispatcherType(javax.servlet.DispatcherType) File(java.io.File) CXFNonSpringJaxrsServlet(org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet)

Aggregations

File (java.io.File)1 DispatcherType (javax.servlet.DispatcherType)1 CXFNonSpringJaxrsServlet (org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet)1 EnvironmentLoaderListener (org.apache.shiro.web.env.EnvironmentLoaderListener)1 SessionHandler (org.eclipse.jetty.server.session.SessionHandler)1 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)1