Bug 771216

Summary: [REST] incorrect content type when requesting non-existing resource
Product: [Other] RHQ Project Reporter: Libor Zoubek <lzoubek>
Component: Core ServerAssignee: Libor Zoubek <lzoubek>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.3CC: hrupp, theute
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-07 19:27:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Libor Zoubek 2012-01-02 14:49:04 UTC
Description of problem: REST API is responding bad content type when it responds 404 (client retrieves unexisting resource)

Version-Release number of selected component (if applicable):
Version: 4.3.0-SNAPSHOT
Build Number: 14fc3e1

How reproducible:always

Steps to Reproduce:
1.request non-existing resource http://localhost:7080/rest/1/resource/0.xml
  
Actual results: server reports content-type to be application/xml but plain text is being send instead (same with json). In most clients this leads to exception when parsing response body.

Expected results: server should respond message that matches content-type even

Comment 1 Heiko W. Rupp 2012-01-03 13:03:28 UTC
89027fe in master

Note that only such errors can be "caught", that actually reach the application code. If an invalid REST-resource (i.e. path) is requested, the the exception is thrown by the container and thus can not be formatted according to requested content types.

Comment 2 Mike Foley 2012-01-16 18:55:12 UTC
verified RHQ 4.3


<rhqErrorWrapper>
<message>A Resource with id 0 does not exist in inventory.</message>
</rhqErrorWrapper>

adding keyword "Needs Testcase" to flag this for possible addition to the QE automation

Comment 3 Libor Zoubek 2012-01-19 18:56:04 UTC
removing keyword "Needs Testcase", testcase 'nonexistingResource' covering this bz is in rest-groovy testuite

Comment 4 Mike Foley 2012-02-07 19:27:43 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE