Convert rcf8040 from web.xml to programmtic web API 69/71269/4
authorTom Pantelis <tompantelis@gmail.com>
Tue, 24 Apr 2018 18:48:30 +0000 (14:48 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Thu, 26 Apr 2018 15:33:41 +0000 (11:33 -0400)
To simplify, the noauth feature was removed. Since this is
a new API, it's been decided not to carry it forward. The
noauth feature for the bierman02 implementation was put in
and kept for legacy reasons.

Change-Id: Ic432b175fae62caee8cc641bb77c19f38a5ab6f6
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
12 files changed:
features/restconf/features-restconf/pom.xml
features/restconf/odl-restconf-nb-rfc8040-noauth/pom.xml [deleted file]
features/restconf/odl-restconf-nb-rfc8040/pom.xml
features/restconf/pom.xml
restconf/restconf-nb-rfc8040/pom.xml
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/RestconfApplication.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/DOMMountPointServiceHandler.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/SchemaContextHandler.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/services/wrapper/ServicesWrapper.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/web/WebInitializer.java [new file with mode: 0644]
restconf/restconf-nb-rfc8040/src/main/resources/WEB-INF/web.xml [deleted file]
restconf/restconf-nb-rfc8040/src/main/resources/org/opendaylight/blueprint/restconf-bp.xml

index 65fd339d1b25e2aabfc3dc067d0a5951ea4390c5..02c37c939f89d68874c1b0c3c93610d39b5123da 100644 (file)
       <type>xml</type>
       <classifier>features</classifier>
     </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>odl-restconf-nb-rfc8040-noauth</artifactId>
-      <version>${project.version}</version>
-      <type>xml</type>
-      <classifier>features</classifier>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>odl-restconf-nb-rfc8040</artifactId>
diff --git a/features/restconf/odl-restconf-nb-rfc8040-noauth/pom.xml b/features/restconf/odl-restconf-nb-rfc8040-noauth/pom.xml
deleted file mode 100644 (file)
index 85c16c6..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017 Pantheon Technologies s.r.o. and others.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/epl-v10.html
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>single-feature-parent</artifactId>
-        <version>3.1.0</version>
-        <relativePath/>
-    </parent>
-
-    <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>odl-restconf-nb-rfc8040-noauth</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
-    <packaging>feature</packaging>
-
-    <name>OpenDaylight :: RESTCONF :: RFC8040</name>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>restconf-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.opendaylight.netconf</groupId>
-            <artifactId>odl-restconf-common</artifactId>
-            <type>xml</type>
-            <classifier>features</classifier>
-        </dependency>
-
-        <dependency>
-            <groupId>org.opendaylight.netconf</groupId>
-            <artifactId>restconf-nb-rfc8040</artifactId>
-        </dependency>
-    </dependencies>
-</project>
index 176486bd8879760b4f3310862d4a5990d4bd7fce..9fb62b3eb80952b64bace70d58288bd6c8998401 100644 (file)
 
     <name>OpenDaylight :: Restconf NB - RFC8040</name>
 
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.opendaylight.netconf</groupId>
+                <artifactId>restconf-artifacts</artifactId>
+                <version>1.8.0-SNAPSHOT</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
     <dependencies>
-        <!-- Enables AAA through aaa-shiro-act -->
         <dependency>
-            <groupId>org.opendaylight.aaa</groupId>
-            <artifactId>odl-aaa-shiro-act</artifactId>
-            <version>0.8.0-SNAPSHOT</version>
+            <groupId>org.opendaylight.netconf</groupId>
+            <artifactId>odl-restconf-common</artifactId>
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.netconf</groupId>
-            <artifactId>odl-restconf-nb-rfc8040-noauth</artifactId>
-            <version>${project.version}</version>
-            <type>xml</type>
-            <classifier>features</classifier>
+            <artifactId>restconf-nb-rfc8040</artifactId>
         </dependency>
     </dependencies>
 </project>
index 0f47d805b3427a302b86b9f68b0d512637fd17f2..c8300f7f9df7a6ef2a4c04dd15ec4b6bb0bf16fd 100644 (file)
@@ -26,7 +26,6 @@
         <module>odl-restconf-all</module>
         <module>odl-restconf-common</module>
         <module>odl-restconf-noauth</module>
-        <module>odl-restconf-nb-rfc8040-noauth</module>
         <module>odl-restconf-nb-rfc8040</module>
         <module>odl-restconf-nb-rfc8040-all</module>
     </modules>
index a820477b600edc53f4b06d219f880dbca77e03f9..9130a59986912ab92b8437fae198b617a670cd2a 100644 (file)
       <artifactId>stax-utils</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>org.json</groupId>
+      <artifactId>json</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.aaa.web</groupId>
+      <artifactId>web-api</artifactId>
+      <version>0.8.0-SNAPSHOT</version>
+    </dependency>
+
     <dependency>
       <groupId>org.opendaylight.aaa</groupId>
-      <artifactId>aaa-shiro-api</artifactId>
+      <artifactId>aaa-filterchain</artifactId>
     </dependency>
 
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-servlet</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-servlets</artifactId>
     </dependency>
 
     <!-- Testing Dependencies -->
         <configuration>
           <instructions>
             <Bundle-Name>MD SAL Restconf Connector</Bundle-Name>
-            <Import-Package>
-              !javax.annotation,
-              javax.ws.rs.*;version="[1.1.0,2.0.0)",
-              *,
-              com.sun.jersey.spi.container.servlet,
-              org.eclipse.jetty.servlets,
-              org.opendaylight.aaa.shiro.filters,
-              org.opendaylight.aaa.shiro.realm,
-              org.opendaylight.aaa.shiro.web.env,
-              org.opendaylight.aaa.filterchain.filters,
-              org.opendaylight.aaa.api,
-              org.apache.shiro.web.env
-            </Import-Package>
-            <Web-ContextPath>/rests</Web-ContextPath>
           </instructions>
         </configuration>
       </plugin>
index 76b560c296196d7f3811e7111304d2b335b73272..89c858788043374e911f576b6cd2f35a74ee8279 100644 (file)
@@ -26,8 +26,16 @@ import org.opendaylight.restconf.nb.rfc8040.jersey.providers.schema.SchemaExport
 import org.opendaylight.restconf.nb.rfc8040.services.wrapper.ServicesWrapper;
 
 public class RestconfApplication extends Application {
-    private final SchemaContextHandler schemaContextHandler = SchemaContextHandler.instance();
-    private final DOMMountPointServiceHandler mountPointServiceHandler = DOMMountPointServiceHandler.instance();
+    private final SchemaContextHandler schemaContextHandler;
+    private final DOMMountPointServiceHandler mountPointServiceHandler;
+    private final ServicesWrapper servicesWrapper;
+
+    public RestconfApplication(SchemaContextHandler schemaContextHandler,
+            DOMMountPointServiceHandler mountPointServiceHandler, ServicesWrapper servicesWrapper) {
+        this.schemaContextHandler = schemaContextHandler;
+        this.mountPointServiceHandler = mountPointServiceHandler;
+        this.servicesWrapper = servicesWrapper;
+    }
 
     @Override
     public Set<Class<?>> getClasses() {
@@ -41,7 +49,7 @@ public class RestconfApplication extends Application {
     @Override
     public Set<Object> getSingletons() {
         final Set<Object> singletons = new HashSet<>();
-        singletons.add(ServicesWrapper.getInstance());
+        singletons.add(servicesWrapper);
         singletons.add(new JsonNormalizedNodeBodyReader(schemaContextHandler, mountPointServiceHandler));
         singletons.add(new JsonToPatchBodyReader(schemaContextHandler, mountPointServiceHandler));
         singletons.add(new XmlNormalizedNodeBodyReader(schemaContextHandler, mountPointServiceHandler));
index e299fe071587c1690620b44669926efdd7444602..311dae724f23a237df5e58aaa26475709ca059fa 100644 (file)
@@ -15,9 +15,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
  *
  */
 public final class DOMMountPointServiceHandler implements Handler<DOMMountPointService> {
-    private static final DOMMountPointServiceHandler INSTANCE = new DOMMountPointServiceHandler();
-
-    private DOMMountPointService domMountPointService;
+    private final DOMMountPointService domMountPointService;
 
     /**
      * Prepare mount point service for Restconf services.
@@ -29,18 +27,8 @@ public final class DOMMountPointServiceHandler implements Handler<DOMMountPointS
         this.domMountPointService = Objects.requireNonNull(domMountPointService);
     }
 
-    @Deprecated
-    private DOMMountPointServiceHandler() {
-    }
-
-    @Deprecated
-    public static DOMMountPointServiceHandler instance() {
-        return INSTANCE;
-    }
-
     public static DOMMountPointServiceHandler newInstance(DOMMountPointService domMountPointService) {
-        INSTANCE.domMountPointService = domMountPointService;
-        return INSTANCE;
+        return new DOMMountPointServiceHandler(domMountPointService);
     }
 
     @Override
index aecbf8d6aed547fe4a773075446606168c40caef..ee29d0afe2c611ff463bbf84a054ca9509d43e65 100644 (file)
@@ -40,12 +40,10 @@ public class SchemaContextHandler implements SchemaContextListenerHandler, AutoC
 
     private static final Logger LOG = LoggerFactory.getLogger(SchemaContextHandler.class);
 
-    private static final SchemaContextHandler INSTANCE = new SchemaContextHandler();
-
     private final AtomicInteger moduleSetId = new AtomicInteger(0);
 
-    private TransactionChainHandler transactionChainHandler;
-    private DOMSchemaService domSchemaService;
+    private final TransactionChainHandler transactionChainHandler;
+    private final DOMSchemaService domSchemaService;
     private ListenerRegistration<SchemaContextListener> listenerRegistration;
 
     private volatile SchemaContext schemaContext;
@@ -61,20 +59,9 @@ public class SchemaContextHandler implements SchemaContextListenerHandler, AutoC
         this.domSchemaService = domSchemaService;
     }
 
-    @Deprecated
-    private SchemaContextHandler() {
-    }
-
-    @Deprecated
-    public static SchemaContextHandler instance() {
-        return INSTANCE;
-    }
-
     public static SchemaContextHandler newInstance(TransactionChainHandler transactionChainHandler,
             DOMSchemaService domSchemaService) {
-        INSTANCE.transactionChainHandler = transactionChainHandler;
-        INSTANCE.domSchemaService = domSchemaService;
-        return INSTANCE;
+        return new SchemaContextHandler(transactionChainHandler, domSchemaService);
     }
 
     public void init() {
index 53c6aee39e2dfbef14ce4bcd0b657cd4587f5eda..de38b6a75b686e5ed4a53c78b2fadcc4a04c05b1 100644 (file)
@@ -48,24 +48,24 @@ import org.opendaylight.restconf.nb.rfc8040.services.simple.impl.RestconfSchemaS
 @Path("/")
 public final class ServicesWrapper implements BaseServicesWrapper, TransactionServicesWrapper {
 
-    private RestconfDataService delegRestconfDataService;
-    private RestconfInvokeOperationsService delegRestconfInvokeOpsService;
-    private RestconfStreamsSubscriptionService delegRestconfSubscrService;
-    private RestconfOperationsService delegRestOpsService;
-    private RestconfSchemaService delegRestSchService;
-    private RestconfService delegRestService;
-
-    @Deprecated
-    private ServicesWrapper() {
-    }
-
-    private static class InstanceHolder {
-        public static final ServicesWrapper INSTANCE = new ServicesWrapper();
-    }
-
-    @Deprecated
-    public static ServicesWrapper getInstance() {
-        return InstanceHolder.INSTANCE;
+    private final RestconfDataService delegRestconfDataService;
+    private final RestconfInvokeOperationsService delegRestconfInvokeOpsService;
+    private final RestconfStreamsSubscriptionService delegRestconfSubscrService;
+    private final RestconfOperationsService delegRestOpsService;
+    private final RestconfSchemaService delegRestSchService;
+    private final RestconfService delegRestService;
+
+    private ServicesWrapper(RestconfDataService delegRestconfDataService,
+            RestconfInvokeOperationsService delegRestconfInvokeOpsService,
+            RestconfStreamsSubscriptionService delegRestconfSubscrService,
+            RestconfOperationsService delegRestOpsService, RestconfSchemaService delegRestSchService,
+            RestconfService delegRestService) {
+        this.delegRestconfDataService = delegRestconfDataService;
+        this.delegRestconfInvokeOpsService = delegRestconfInvokeOpsService;
+        this.delegRestconfSubscrService = delegRestconfSubscrService;
+        this.delegRestOpsService = delegRestOpsService;
+        this.delegRestSchService = delegRestSchService;
+        this.delegRestService = delegRestService;
     }
 
     public static ServicesWrapper newInstance(final SchemaContextHandler schemaCtxHandler,
@@ -73,24 +73,25 @@ public final class ServicesWrapper implements BaseServicesWrapper, TransactionSe
             final TransactionChainHandler transactionChainHandler, final DOMDataBrokerHandler domDataBrokerHandler,
             final RpcServiceHandler rpcServiceHandler, final NotificationServiceHandler notificationServiceHandler,
             final DOMSchemaService domSchemaService) {
-        InstanceHolder.INSTANCE.delegRestOpsService =
+        RestconfOperationsService restconfOpsService =
                 new RestconfOperationsServiceImpl(schemaCtxHandler, domMountPointServiceHandler);
         final DOMYangTextSourceProvider yangTextSourceProvider =
                 (DOMYangTextSourceProvider) domSchemaService.getSupportedExtensions()
                         .get(DOMYangTextSourceProvider.class);
-        InstanceHolder.INSTANCE.delegRestSchService =
+        RestconfSchemaService restconfSchemaService =
                 new RestconfSchemaServiceImpl(schemaCtxHandler, domMountPointServiceHandler,
                 yangTextSourceProvider);
-        InstanceHolder.INSTANCE.delegRestconfSubscrService =
+        RestconfStreamsSubscriptionService restconfSubscrService =
                 new RestconfStreamsSubscriptionServiceImpl(domDataBrokerHandler,
                 notificationServiceHandler, schemaCtxHandler, transactionChainHandler);
-        InstanceHolder.INSTANCE.delegRestconfDataService =
+        RestconfDataService restconfDataService =
                 new RestconfDataServiceImpl(schemaCtxHandler, transactionChainHandler, domMountPointServiceHandler,
-                        InstanceHolder.INSTANCE.delegRestconfSubscrService);
-        InstanceHolder.INSTANCE.delegRestconfInvokeOpsService =
+                        restconfSubscrService);
+        RestconfInvokeOperationsService restconfInvokeOpsService =
                 new RestconfInvokeOperationsServiceImpl(rpcServiceHandler, schemaCtxHandler);
-        InstanceHolder.INSTANCE.delegRestService = new RestconfImpl(schemaCtxHandler);
-        return InstanceHolder.INSTANCE;
+        RestconfService restconfService = new RestconfImpl(schemaCtxHandler);
+        return new ServicesWrapper(restconfDataService, restconfInvokeOpsService,
+                restconfSubscrService, restconfOpsService, restconfSchemaService, restconfService);
     }
 
     @Override
diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/web/WebInitializer.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/web/WebInitializer.java
new file mode 100644 (file)
index 0000000..5339adc
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018 Inocybe Technologies and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.restconf.nb.rfc8040.web;
+
+import javax.servlet.ServletException;
+import javax.ws.rs.core.Application;
+import org.opendaylight.aaa.filterchain.configuration.CustomFilterAdapterConfiguration;
+import org.opendaylight.aaa.filterchain.filters.CustomFilterAdapter;
+import org.opendaylight.aaa.web.FilterDetails;
+import org.opendaylight.aaa.web.ServletDetails;
+import org.opendaylight.aaa.web.WebContext;
+import org.opendaylight.aaa.web.WebContextBuilder;
+import org.opendaylight.aaa.web.WebContextRegistration;
+import org.opendaylight.aaa.web.WebContextSecurer;
+import org.opendaylight.aaa.web.WebServer;
+
+/**
+ * Initializes the rfc8040 web app endpoint.
+ *
+ * @author Thomas Pantelis
+ */
+public class WebInitializer {
+    private final WebContextRegistration registration;
+
+    public WebInitializer(WebServer webServer,  WebContextSecurer webContextSecurer,
+            Application webApp, CustomFilterAdapterConfiguration customFilterAdapterConfig) throws ServletException {
+        WebContextBuilder webContextBuilder = WebContext.builder().contextPath("rests").supportsSessions(true)
+                .addServlet(ServletDetails.builder().servlet(
+                        new com.sun.jersey.spi.container.servlet.ServletContainer(webApp))
+                    .addUrlPattern("/*").build())
+
+                // Allows user to add javax.servlet.Filter(s) in front of REST services
+                .addFilter(FilterDetails.builder().filter(new CustomFilterAdapter(customFilterAdapterConfig))
+                    .addUrlPattern("/*").build())
+
+                .addFilter(FilterDetails.builder().filter(new org.eclipse.jetty.servlets.GzipFilter())
+                    .putInitParam("mimeTypes",
+                        "application/xml,application/yang.data+xml,xml,application/json,application/yang.data+json")
+                    .addUrlPattern("/*").build());
+
+        webContextSecurer.requireAuthentication(webContextBuilder, "/*");
+
+        registration = webServer.registerWebContext(webContextBuilder.build());
+    }
+
+    public void close() {
+        if (registration != null) {
+            registration.close();
+        }
+    }
+}
diff --git a/restconf/restconf-nb-rfc8040/src/main/resources/WEB-INF/web.xml b/restconf/restconf-nb-rfc8040/src/main/resources/WEB-INF/web.xml
deleted file mode 100644 (file)
index 058ccb8..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
-    version="3.0">
-
-    <servlet>
-        <servlet-name>Restconf-rfc8040</servlet-name>
-        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
-        <init-param>
-            <param-name>javax.ws.rs.Application</param-name>
-            <param-value>org.opendaylight.restconf.nb.rfc8040.RestconfApplication</param-value>
-        </init-param>
-        <load-on-startup>0</load-on-startup>
-    </servlet>
-
-    <context-param>
-      <param-name>shiroEnvironmentClass</param-name>
-      <param-value>org.opendaylight.aaa.shiro.web.env.KarafIniWebEnvironment</param-value>
-    </context-param>
-
-    <listener>
-        <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
-    </listener>
-
-    <filter>
-        <filter-name>ShiroFilter</filter-name>
-        <filter-class>org.opendaylight.aaa.shiro.filters.AAAFilter</filter-class>
-    </filter>
-
-    <filter-mapping>
-        <filter-name>ShiroFilter</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
-
-    <filter>
-        <filter-name>DynamicFilterChain</filter-name>
-        <filter-class>org.opendaylight.aaa.filterchain.filters.CustomFilterAdapter</filter-class>
-    </filter>
-
-    <filter-mapping>
-        <filter-name>DynamicFilterChain</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
-
-    <servlet-mapping>
-        <servlet-name>Restconf-rfc8040</servlet-name>
-        <url-pattern>/*</url-pattern>
-    </servlet-mapping>
-
-    <filter>
-        <filter-name>GzipFilter</filter-name>
-        <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
-        <init-param>
-            <param-name>mimeTypes</param-name>
-            <param-value>application/xml,application/yang.data+xml,xml,application/json,application/yang.data+json</param-value>
-        </init-param>
-    </filter>
-    <filter-mapping>
-        <filter-name>GzipFilter</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
-
-    <filter>
-        <filter-name>cross-origin-restconf</filter-name>
-        <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
-        <init-param>
-            <param-name>allowedOrigins</param-name>
-            <param-value>*</param-value>
-        </init-param>
-        <init-param>
-            <param-name>allowedMethods</param-name>
-            <param-value>GET,POST,OPTIONS,DELETE,PUT,HEAD</param-value>
-        </init-param>
-        <init-param>
-            <param-name>allowedHeaders</param-name>
-            <param-value>origin, content-type, accept, authorization</param-value>
-        </init-param>
-        <init-param>
-            <param-name>exposedHeaders</param-name>
-            <param-value>location</param-value>
-        </init-param>
-    </filter>
-    <filter-mapping>
-        <filter-name>cross-origin-restconf</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
-
-    <security-constraint>
-        <web-resource-collection>
-            <web-resource-name>Restconf NB RFC api</web-resource-name>
-            <url-pattern>/*</url-pattern>
-            <http-method>POST</http-method>
-            <http-method>GET</http-method>
-            <http-method>PUT</http-method>
-            <http-method>PATCH</http-method>
-            <http-method>DELETE</http-method>
-            <http-method>HEAD</http-method>
-        </web-resource-collection>
-    </security-constraint>
-
-</web-app>
index 022982962ffc2fc00b4f53fbd2bc62c76b1257f1..e7719c4fa9bf88933f07717b6b2237086f775423 100644 (file)
@@ -26,9 +26,6 @@
     </cm:default-properties>
   </cm:property-placeholder>
 
-  <!-- We need the AAAService available even though we don't use it -->
-  <reference interface="org.opendaylight.aaa.api.AAAService"/>
-
   <reference id="domRpcService" interface="org.opendaylight.controller.md.sal.dom.api.DOMRpcService"/>
   <reference id="domMountPointService" interface="org.opendaylight.controller.md.sal.dom.api.DOMMountPointService"/>
   <reference id="domNotificationService" interface="org.opendaylight.controller.md.sal.dom.api.DOMNotificationService"/>
     <argument ref="domSchemaService"/>
   </bean>
 
+  <bean id="restconfApplication" class="org.opendaylight.restconf.nb.rfc8040.RestconfApplication">
+    <argument ref="schemaContextHandler"/>
+    <argument ref="mountPointServiceHandler"/>
+    <argument ref="servicesWrapper"/>
+  </bean>
+
   <!-- JSONRestconfService -->
   <bean id="jsonRestconfService"
       class="org.opendaylight.restconf.nb.rfc8040.rests.services.impl.JSONRestconfServiceRfc8040Impl"
   <service ref="jsonRestconfService" odl:type="rfc8040"
       interface="org.opendaylight.restconf.nb.rfc8040.rests.services.api.JSONRestconfService" />
 
+  <!-- Web app registration -->
+
+  <reference id="customFilterAdapterConfig"
+      interface="org.opendaylight.aaa.filterchain.configuration.CustomFilterAdapterConfiguration"/>
+
+  <reference id="webServer" interface="org.opendaylight.aaa.web.WebServer" />
+
+  <reference id="webContextSecurer" interface="org.opendaylight.aaa.web.WebContextSecurer" />
+
+  <bean id="webInitializer" class="org.opendaylight.restconf.nb.rfc8040.web.WebInitializer"
+          destroy-method="close">
+    <argument ref="webServer"/>
+    <argument ref="webContextSecurer"/>
+    <argument ref="restconfApplication"/>
+    <argument ref="customFilterAdapterConfig"/>
+  </bean>
+
 </blueprint>