Bug 993548

Summary: Paging does not work for JSONP wrapping of requests
Product: [Other] RHQ Project Reporter: Heiko W. Rupp <hrupp>
Component: RESTAssignee: Heiko W. Rupp <hrupp>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.8CC: osgoodjw
Target Milestone: ---   
Target Release: RHQ 4.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-26 08:31:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Quick test to output the results of a jsonp request with paging. none

Description Heiko W. Rupp 2013-08-06 07:15:40 UTC
From Community: https://community.jboss.org/message/830028

I've recently encountered what I believe to be an issue with paging/jsonp support in the REST API. According to this post by Heiko, paging metadata can be returned in one of the following ways:
In the response header
In the body of the message
 
Due to the nature of jsonp, I can't access the response header - the first approach won't work for me. Instead, I must use the second approach.
 
This is where I'm running into issues. In order to achieve the second approach, I have to include the following header in my request:
 
"Accept=application/vnd.rhq.wrapped+json"
 
Again, due to the nature of jsonp, I cannot modify the headers in my request. It seems that I effectively have no way of getting paging information through jsonp.
 
Is there another recommended approach to getting paging information with jsonp? If not, is there any intention of supporting this in the future?

Comment 1 Heiko W. Rupp 2013-08-06 16:27:46 UTC
master 8e606386ce has a potential fix and a testcase.

Comment 2 Josh Osgood 2013-08-06 20:53:31 UTC
Created attachment 783509 [details]
Quick test to output the results of a jsonp request with paging.

Note
* The jsonp request should be modified to point to your particular RHQ server.


Overview
* This test outputs the response of a simple jsonp request to the console.


Results
* Examine the response in the console - it should include a single platform object.
* RHQ returned the first page successfully, but we have no way of accessing paging metadata.

Analysis
* Be default, paging metadata is returned in the response headers. Because jsonp only passes the response body to the callback function, we have no way of accessing this metadata.
* RHQ is capable of embedding this metadata in the response body (which would solve the problem), but we can only trigger this by including a particular header with our request. Because jsonp works through a script tag, we have no way of specifying the header and triggering this response formatting.

Possible Solutions
* Allow us to include a query parameter with our request that will trigger the necessary response formatting, rather than depending on a request header.
* Alternatively - make this the default formatting when jsonp is specified, since it can't effectively use the other formatting anyway.

Comment 3 Heiko W. Rupp 2014-03-26 08:31:12 UTC
Bulk closing now that 4.10 is out.

If you think an issue is not resolved, please open a new BZ and link to the existing one.