Introduce HttpStatusCode 42/111342/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 9 Apr 2024 20:35:33 +0000 (22:35 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 9 Apr 2024 21:22:50 +0000 (23:22 +0200)
commit4e2e5beb0ab9fa93b74ea1ce97969cf15257630f
tree25525bd888d2cc78798eb6f6ed9ba83a6066d454
parent2bb148284126ce63c972814689bd3da46c5cd348
Introduce HttpStatusCode

RESTCONF fall into two categories a success, indicating a 20x status or
a failure, indicating a 40x status. RestconfDocumentedException acts as
a wrapper for the latter case, with the additional twist of being able
to report multiple errors via the 'yang-errors' template.

All failure modes in RESTCONF end up being driven by a YANG ErrorTag,
hence our server-size response structure really wants to be split along
success/failure lines.

This patch takes the first step towards that split, defining a
restconf.api.HttpStatusCode, which acts as a semantic capture of a HTTP
Status Code and use that in error mapping logic.

While we are visiting here, we make the status code for data-missing
configurable for each northbound instance -- rather than our previous
use of a global property.

JIRA: NETCONF-1188
Change-Id: I1365256f9fad4ffe66358e6e9da4dfa337a755fd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 files changed:
protocol/restconf-api/src/main/java/org/opendaylight/restconf/api/HttpStatusCode.java [new file with mode: 0644]
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/jaxrs/JaxRsRestconf.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/ErrorTagMapping.java [new file with mode: 0644]
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/JaxRsNorthbound.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/OSGiNorthbound.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapper.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/legacy/ErrorTags.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/DefaultRestconfStreamServletFactory.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/RestconfStreamServletFactory.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/jaxrs/AbstractRestconfTest.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/jaxrs/Netconf799Test.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/jaxrs/RestconfSchemaServiceMountTest.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/jaxrs/RestconfSchemaServiceTest.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/ErrorTagsTest.java [moved from restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/legacy/ErrorTagsTest.java with 87% similarity]
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapperTest.java