[NETCONF-8] OPTIONS HTTP method cannot return JSON response but 405 method Created: 06/Oct/14 Updated: 23/Sep/20 Resolved: 23/Sep/20 |
|
| Status: | Resolved |
| Project: | netconf |
| Component/s: | restconf-nb |
| Affects Version/s: | None |
| Fix Version/s: | Aluminium SR1 |
| Type: | Improvement | ||
| Reporter: | RichardHill | Assignee: | RichardHill |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | 0 minutes | ||
| Time Spent: | 3 hours | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Attachments: |
|
| Description |
|
Testing this I expected a HTTP "OPTIONS" request in both XML and JSON formats to return 200 and a payload describing the OPTIONS available. The XML test was successful, but the JSON test failed and threw a 405 HTTP ERROR. ###Test setup ### ###Steps Create a data resource curl -v -X POST -d "<nodes xmlns=\"urn:opendaylight:inventory\"><node><id>id1</id></node></nodes>" localhost:8080/restconf/config/ --header "Content-Type:application/xml" --header "Accept:application/xml" Verify it was present curl -v -X GET 172.29.50.236:8080/re "Content-Type:application/xml" --header "Accept:application/xml" Now I tried to check the OPTIONS, looks ok with XML curl -v -X OPTIONS 172.29.50.236:8080/restconf/config/opendaylight-inventory:nodes/node/id1 "Content-Type:application/xml" --header "Accept:application/xml This returns XML you can see it in the attachment. curl -v -X OPTIONS 172.29.50.236:8080/restconf/config/opendaylight-inventory:nodes/node/id1 "Content-Type:application/xml" --header "Accept:application/json returns $)% status and a HTML page with a tomcat error message "The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers." |
| Comments |
| Comment by RichardHill [ 06/Oct/14 ] |
|
Attachment OPTION-HTTP-response-in-XML.txt has been added with description: Response in XML fromat from OPTIONS HTTP method |
| Comment by Tony Tkacik [ 06/Oct/14 ] |
|
This could be fixed in NormalizedNodeJSONBodyWriter and NormalizedNodeXmlBodyWriter Both StreamWriters (JSON and XML) should have property to enable indentation, or at |
| Comment by Jozef Gloncak [ 14/Oct/14 ] |
|
Response to HTTP OPTIONS operation isn't implemented via @OPTIONS jax-rs annotation. For this case according to JAX-RS specification http://download.oracle.com/otndocs/jcp/jaxrs-1.1-mrel-eval-oth-JSpec/ the following behavior is requested(quoting 3.3.5) >>>>> Details about how second possibility is specified in jersey is described in https://jersey.java.net/documentation/latest/wadl.html#d0e11496. As was specified in response for Accept: application/json It seems that only application/xml format is supported by jersey implementation. My conclusion is that testing scenario where you are awaiting JSON output for OPTIONS HTTP request isn't valid. |
| Comment by Robert Varga [ 13/Nov/15 ] |
|
Move to NETCONF project |
| Comment by Iaroslav Kholiavko [ 23/Sep/20 ] |
|
Could not reproduce onĀ Aluminium |