Added ExceptionMapper to RFC-8040 impl 27/83527/12
authorJaroslav Tóth <jtoth@frinx.io>
Thu, 8 Aug 2019 15:01:13 +0000 (17:01 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Aug 2019 10:50:58 +0000 (12:50 +0200)
commit1b6442243f1ad2107c764a7f61d0bca9e21864c1
tree1d197dd0ca27d06d80cab910702512f151e90946
parent041ad3d78d2f71355b645f099b8ee93f1aa7dfb4
Added ExceptionMapper to RFC-8040 impl

It is similar to draft-02 implementation but with several diffs
that had to be made because of compliancy against specification,
different revisions of QNames, and need for refactoring:
- Response must have yang-data+json or yang-data+xml types, the
  parsing of request content type and acceptable media types was
  adjusted accordingly.
- Schema context was used as feed to NormalizedNode builders -
  this approach is useless.
- Anonymous classes used for special serializaton with disabled
  validation of error-info leaf were moved to distinct classes
  (they share some lines of code, so the abstract parent class
  is added).
- Added error-path leaf to serialized JSON/XML data (it was in
  todo tag for unknown reasons).
- Next small fixes and refactoring of code by extraction of
  methods.
- Unit test was written from scratch, because of changes done
  to parsing of status code and media type.

Change-Id: I9c17229e8df1b382a37ca588a506128040c6d42f
Signed-off-by: Jaroslav Tóth <jtoth@frinx.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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/Rfc8040.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/JsonStreamWriterWithDisabledValidation.java [new file with mode: 0644]
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapper.java [new file with mode: 0644]
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/StreamWriterWithDisabledValidation.java [new file with mode: 0644]
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/XmlStreamWriterWithDisabledValidation.java [new file with mode: 0644]
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapperTest.java [new file with mode: 0644]