Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-1210

RESTCONF OPTIONS on /data does not produce Accept-Patch

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • 8.0.0, 7.0.5
    • 4.0.9, 6.0.5, 5.0.9
    • restconf-nb

      Our default implementation of OPTIONS defers to JAX-RS runtime to generate the response to OPTIONS on all endpoints.

      This leads to two outcomes:

      1. we do not attach Accept-Patch header, as required by RESTCONF PATCH
      2. we serve a WADL which leaks our implementation details
      * processing: http://localhost:8181/rests/data
      *   Trying [::1]:8181...
      * Connected to localhost (::1) port 8181
      * Server auth using Basic with user 'admin'
      > OPTIONS /rests/data HTTP/1.1
      > Host: localhost:8181
      > Authorization: Basic YWRtaW46YWRtaW4=
      > User-Agent: curl/8.2.1
      > Accept: */*
      > 
      < HTTP/1.1 200 OK
      < Set-Cookie: JSESSIONID=node01fob7f15na96q1fx8i99uqh8cb14.node0; Path=/rests; HttpOnly
      < Expires: Thu, 01 Jan 1970 00:00:00 GMT
      < Set-Cookie: rememberMe=deleteMe; Path=/rests; Max-Age=0; Expires=Tue, 05-Dec-2023 11:05:56 GMT; SameSite=lax
      < Content-Type: application/vnd.sun.wadl+xml
      < Allow: HEAD,POST,GET,OPTIONS,PATCH,PUT
      < Last-Modified: Wed, 06 Dec 2023 12:05:56 CET
      < Content-Length: 3853
      < 
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <application xmlns="http://wadl.dev.java.net/2009/02">
          <doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey: 2.41 2023-10-20 08:17:02"/>
          <grammars/>
          <resources base="http://localhost:8181/rests/">
              <resource path="data">
                  <method id="dataXmlPATCH" name="PATCH">
                      <request>
                          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                          <representation mediaType="application/yang-data+xml"/>
                          <representation mediaType="application/xml"/>
                          <representation mediaType="text/xml"/>
                      </request>
                  </method>
                  <method id="dataJsonPATCH" name="PATCH">
                      <request>
                          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                          <representation mediaType="application/yang-data+json"/>
                          <representation mediaType="application/json"/>
                      </request>
                  </method>
                  <method id="dataYangJsonPATCH" name="PATCH">
                      <request>
                          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                          <representation mediaType="application/yang-patch+json"/>
                      </request>
                  </method>
                  <method id="dataYangXmlPATCH" name="PATCH">
                      <request>
                          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                          <representation mediaType="application/yang-patch+xml"/>
                      </request>
                  </method>
                  <method id="postDataJSON" name="POST">
                      <request>
                          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                          <representation mediaType="application/yang-data+json"/>
                          <representation mediaType="application/json"/>
                      </request>
                  </method>
                  <method id="postDataXML" name="POST">
                      <request>
                          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                          <representation mediaType="application/yang-data+xml"/>
                          <representation mediaType="application/xml"/>
                          <representation mediaType="text/xml"/>
                      </request>
                  </method>
                  <method id="dataJsonPUT" name="PUT">
                      <request>
                          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                          <representation mediaType="application/yang-data+json"/>
                          <representation mediaType="application/json"/>
                      </request>
                  </method>
                  <method id="dataXmlPUT" name="PUT">
                      <request>
                          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                          <representation mediaType="application/yang-data+xml"/>
                          <representation mediaType="application/xml"/>
                          <representation mediaType="text/xml"/>
                      </request>
                  </method>
                  <method id="dataGET" name="GET">
                      <request>
                          <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="javax.ws.rs.container.Suspended" type="xs:string"/>
                      </request>
                  </method>
              </resource>
          </resources>
      </application>
      

      Provide @OPTIONS overrides for our top-level responses, so that we provide the required header and do not leak the WADL.

            Unassigned Unassigned
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: