Bug 771216 - [REST] incorrect content type when requesting non-existing resource
Summary: [REST] incorrect content type when requesting non-existing resource
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 4.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified vote
Target Milestone: ---
: ---
Assignee: Libor Zoubek
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-02 14:49 UTC by Libor Zoubek
Modified: 2015-11-02 00:42 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-07 19:27:43 UTC


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.