click here for details... Sakai Executive Director Position Search now open
Issue Details (XML | Word | Printable)

Key: SAK-16757
Type: Task Task
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Aaron Zeckoski
Reporter: Noah Botimer
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sakai

Add support for JSONP callbacks on entity data feeds

Created: 25-Jul-2009 18:48   Updated: 26-Jul-2009 00:54
Component/s: Entity Broker
Affects Version/s: 2.6.0
Fix Version/s: 2.7.0

Time Tracking:
Not Specified

Issue Links:
Relate
 

2.6.x Status: None
2.5.x Status: None
2.4.x Status: None


 Description  « Hide
To enable mashup scenarios, it should be possible to wrap a JSON serialization of an entity in a callback (JSONP). Common web APIs provide a default named callback but also allow specifying one as a GET parameter to facilitate usage of various scripting libraries. This functionality should be made available in the default distribution of the Entity Broker so that developers need not implement a custom format when JSONP is desired.

 All   Comments   Work Log   Change History   Subversion Commits   git Commits      Sort Order: Ascending order - Click to sort in descending order
Noah Botimer added a comment - 25-Jul-2009 19:48
This has been added and checked in, with some basic tests.

After some discussion with Aaron, we decided that a new format extension was the right approach, at least for now. This is intended to preserve the semantics of .json implying a feed that will validate against the JSON spec (via JSONLint or other). It may also allay some security concerns about JSONP in general by requiring an entity developer to opt in to this behavior. By default, using the .jsonp extension will add a call to jsonEntityFeed() around the JSON object. This can be specified with a query parameter of jsonCallback.

For example:

http://sakai/direct/some-entity/some-id.jsonp will use the default callback: jsonEntityFeed({...})
http://sakai/direct/some-entity/some-id.jsonp?jsonCallback=myCustomCallback will call myCustomCallback({...})

None of the default entities have the JSONP format enabled now. We may decide that this is appropriate at some later point. Also, we may decide that the distinction between JSON and JSONP is not ideal and apply the callback parameter to the standard JSON handler, thereby allowing any JSON-compatible entities to be used with or without a JSONP callback based on consumer parameters.