* 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.rests.services.impl;
+package org.opendaylight.restconf.nb.jaxrs;
import static java.util.Objects.requireNonNull;
/**
* Controller for determining the {@code Root Resource} of the RESTCONF API. This interface serves up a
* {@code host-meta} document as defined in
- * <a href="https://tools.ietf.org/html/rfc8040#section-3">RFC6415 section 3</a>.
+ * <a href="https://tools.ietf.org/html/rfc6415#section-3">RFC6415 The host-meta Document</a>.
*/
// FIXME: this really should be the endpoint's job to aggregate these. Once JAX-RS (or any other wiring) can provide it,
// integrate with that framework, so we co-exist with others.
@Path("/")
-public final class RootResourceDiscoveryServiceImpl {
+public final class JaxRsWebHostMetadata {
private final String restconfRoot;
- public RootResourceDiscoveryServiceImpl(final String restconfRoot) {
+ public JaxRsWebHostMetadata(final String restconfRoot) {
this.restconfRoot = requireNonNull(restconfRoot);
}
package org.opendaylight.restconf.nb.rfc8040;
import com.google.common.annotations.Beta;
+import java.util.Set;
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.servlet.ServletSupport;
import org.opendaylight.mdsal.dom.api.DOMMountPointService;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.restconf.nb.jaxrs.JaxRsWebHostMetadata;
import org.opendaylight.restconf.nb.rfc8040.streams.RestconfStreamServletFactory;
import org.opendaylight.restconf.server.api.RestconfServer;
import org.opendaylight.restconf.server.spi.DatabindProvider;
.supportsSessions(false)
.addServlet(ServletDetails.builder()
.addUrlPattern("/*")
- .servlet(servletSupport.createHttpServletBuilder(new RootFoundApplication(URLConstants.BASE_PATH))
- .build())
+ .servlet(servletSupport.createHttpServletBuilder(
+ new Application() {
+ @Override
+ public Set<Object> getSingletons() {
+ return Set.of(new JaxRsWebHostMetadata(URLConstants.BASE_PATH));
+ }
+ }).build())
.name("Rootfound")
.build());
+++ /dev/null
-/*
- * Copyright (c) 2020 ZTE Corp. 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;
-
-import java.util.Set;
-import javax.ws.rs.core.Application;
-import org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper;
-import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RootResourceDiscoveryServiceImpl;
-
-public class RootFoundApplication extends Application {
- private final RootResourceDiscoveryServiceImpl rrds;
-
- public RootFoundApplication(final String restconfRoot) {
- rrds = new RootResourceDiscoveryServiceImpl(restconfRoot);
- }
-
- @Override
- public Set<Class<?>> getClasses() {
- return Set.of(RestconfDocumentedExceptionMapper.class);
- }
-
- @Override
- public Set<Object> getSingletons() {
- return Set.of(rrds);
- }
-}
* 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.rests.services.impl;
+package org.opendaylight.restconf.nb.jaxrs;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class RootResourceDiscoveryServiceImplTest {
- private final RootResourceDiscoveryServiceImpl svc = new RootResourceDiscoveryServiceImpl("fooBarBaz");
+class JaxRsWebHostMetadataTest {
+ private final JaxRsWebHostMetadata svc = new JaxRsWebHostMetadata("fooBarBaz");
@Test
- public void testJsonData() {
+ void testJsonData() {
final var response = svc.readJsonData();
assertEquals(200, response.getStatus());
assertEquals("""
}
@Test
- public void testXrdData() {
+ void testXrdData() {
final var response = svc.readXrdData();
assertEquals(200, response.getStatus());
assertEquals("""