Tweaks to Javascript Responses with RestHeloper
(No description)
Leave a comment
on 2011-05-27 07:51 *
By kenneth.lim
This ticket references this conversation in the mailing list:
https://groups.google.com/group/liftweb/browse_thread/thread/14fe3e678380c69c#
Problems:
1. Using JE.Call to construct a JsonP response object results in a JsonResponse. It should be a JavascriptResponse as JsonP is a method call.
2. The existing JavascriptResponse object returns the content type of "text/javascript". RFC 4329 (http://www.rfc-editor.org/rfc/rfc4329.txt) recommends using
"application/javascript" as 'Use of the "text" top-level type for this kind of content is known to be problematic
Proposed solution:
1. RestHelper should implicitly convert JsExp into JavascriptResponses.
See https://github.com/lift/framework/blob/master/web/webkit/src/main/scala/net/liftweb/http/rest/RestHelper.scala#L611
2. JavascriptResponses should return the Content-Type of "application/javascript" (instead of text/javascript)
See https://github.com/lift/framework/blob/master/web/webkit/src/main/scala/net/liftweb/http/LiftResponse.scala#L263
Cheers!
https://groups.google.com/group/liftweb/browse_thread/thread/14fe3e678380c69c#
Problems:
1. Using JE.Call to construct a JsonP response object results in a JsonResponse. It should be a JavascriptResponse as JsonP is a method call.
2. The existing JavascriptResponse object returns the content type of "text/javascript". RFC 4329 (http://www.rfc-editor.org/rfc/rfc4329.txt) recommends using
"application/javascript" as 'Use of the "text" top-level type for this kind of content is known to be problematic
Proposed solution:
1. RestHelper should implicitly convert JsExp into JavascriptResponses.
See https://github.com/lift/framework/blob/master/web/webkit/src/main/scala/net/liftweb/http/rest/RestHelper.scala#L611
2. JavascriptResponses should return the Content-Type of "application/javascript" (instead of text/javascript)
See https://github.com/lift/framework/blob/master/web/webkit/src/main/scala/net/liftweb/http/LiftResponse.scala#L263
Cheers!
(In revision:dd83b199d6ca6a377f4ac24c3ad342a1a378c246) Closes #1024 (aka 2^10). Fixed implicit conversions and fixed up some header, etc. stuff on responses
Branch: master
Branch: master