Add support for RFC8072 media types
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / api / RootResourceDiscoveryService.java
1 /*
2  * Copyright (c) 2020 ZTE Corp. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.restconf.nb.rfc8040.rests.services.api;
9
10 import javax.ws.rs.GET;
11 import javax.ws.rs.Path;
12 import javax.ws.rs.Produces;
13 import javax.ws.rs.core.MediaType;
14 import javax.ws.rs.core.Response;
15 import org.opendaylight.restconf.nb.rfc8040.Rfc8040.MediaTypes;
16 import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
17
18 /**
19  * Controller for determining the {@code Root Resource} of the RESTCONF API. This interface serves up a
20  * {@code host-meta} document as defined in
21  * <a href="https://tools.ietf.org/html/rfc8040#section-3">RFC6415 section 3</a>.
22  */
23 // FIXME: this really should be the endpoint's job to aggregate these. Once JAX-RS (or any other wiring) can provide it,
24 //        integrate with that framework, so we co-exist with others.
25 public interface RootResourceDiscoveryService {
26     /**
27      * Root Resource Discovery. See: https://tools.ietf.org/html/rfc8040#section-3.1
28      */
29     @GET
30     @Path("/host-meta")
31     @Produces({ MediaTypes.XRD + RestconfConstants.XML })
32     Response readXrdData();
33
34     /**
35      * Root Resource Discovery as a <a href="https://tools.ietf.org/html/rfc6415#appendix-A">JRD</a>.
36      */
37     @GET
38     @Path("/host-meta.json")
39     @Produces({ MediaTypes.XRD + RestconfConstants.JSON, MediaType.APPLICATION_JSON })
40     Response readJsonData();
41 }