Bug 993548 - Paging does not work for JSONP wrapping of requests
Summary: Paging does not work for JSONP wrapping of requests
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: REST
Version: 4.8
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHQ 4.9
Assignee: Heiko W. Rupp
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-06 07:15 UTC by Heiko W. Rupp
Modified: 2014-03-26 08:31 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-03-26 08:31:12 UTC
Embargoed:


Attachments (Terms of Use)
Quick test to output the results of a jsonp request with paging. (392 bytes, text/html)
2013-08-06 20:53 UTC, Josh Osgood
no flags Details

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.


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