On Wed, Jan 27, 2010 at 12:53 PM, Vidar Ramdal <[email protected]> wrote:

> HtmlResponse is in the exported in o.a.s.api.servlets, so we probably
> can't mess around with it a lot, for backward compatibility.
> The HtmlResponse.send() method is public, but I guess it is intended
> for use only from SlingPostServlet?
>
> I suggest we deprecate HtmlResponse, and create a subclass of it
> called, say, PostResponse. "Subclassing" to create a more generic
> class sounds weird, but I'm not sure how we otherwise could preserve
> compatibility.
>
> The HtmlResponse.send() is deprecated, and its functionality moved to
> SlingPostServlet as sendHtml(). We also introduce
> SlingPostServlet.sendJson().
> Finally, we implement the logic for choosing either sendHtml() or
> sendJson(), based on:
> 1. The format of the posted data - if JSON is posted (SLING-1172),
> return JSON, otherwise return HTML
> 2. The Accept HTTP header - if set to "application/json" return JSON,
> otherwise return HTML
> 3. Possibly also an :accept form field, with the same value as the
> HTTP header, in case it is proven that setting the HTTP header does
> not work in some browsers

Filed this as https://issues.apache.org/jira/browse/SLING-1336

-- 
Vidar S. Ramdal <[email protected]> - http://www.idium.no
Sommerrogata 13-15, N-0255 Oslo, Norway
+ 47 22 00 84 00 / +47 21 531941, ext 2070

Reply via email to