2 * Copyright (c) 2018 Inocybe Technologies and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.sal.rest.doc.jaxrs;
10 import javax.servlet.ServletException;
11 import javax.ws.rs.core.Application;
12 import org.opendaylight.aaa.web.ResourceDetails;
13 import org.opendaylight.aaa.web.ServletDetails;
14 import org.opendaylight.aaa.web.WebContext;
15 import org.opendaylight.aaa.web.WebContextBuilder;
16 import org.opendaylight.aaa.web.WebContextRegistration;
17 import org.opendaylight.aaa.web.WebContextSecurer;
18 import org.opendaylight.aaa.web.WebServer;
21 * Initializes the wep app.
23 * @author Thomas Pantelis
25 public class WebInitializer {
26 private final WebContextRegistration registration;
28 public WebInitializer(WebServer webServer, WebContextSecurer webContextSecurer, Application webApp)
29 throws ServletException {
30 WebContextBuilder webContextBuilder = WebContext.builder().contextPath("apidoc").supportsSessions(true)
31 .addServlet(ServletDetails.builder().servlet(
32 new com.sun.jersey.spi.container.servlet.ServletContainer(webApp))
33 .addUrlPattern("/apis/*").addUrlPattern("/18/apis/*").build())
34 .addResource(ResourceDetails.builder().name("/explorer").build())
35 .addResource(ResourceDetails.builder().name("/18/explorer").build());
37 webContextSecurer.requireAuthentication(webContextBuilder, "/apis/*", "/18/apis/*");
39 registration = webServer.registerWebContext(webContextBuilder.build());