Re: SlingPostServlet saves operations that throw an error in the log but return 200 responses

2010-04-01 Thread Alexander Klimetschek
On Thu, Apr 1, 2010 at 20:13, Michael Yin  wrote:
> Just tested this. setting ":status" to "standard" still resulted in a 200 OK
> response.

Looks like a bug. I quickly looked at the newest version of the code
involved and it looks a bit different than before and too complicated
(*) to see the code paths without debugging. But it seems that it
could spit out a 200 even if an exception happened.

I think you should report an issue in Jira.

(*) My observations: HtmlResponse and the new JSONResponse have
prepare() (sets status code before send() sets it again), a
PN_STATUS_CODE property (never set?), getError() (overrides
PN_STATUS_CODE?) and a setStatus parameter in send (ignored in
JSONResponse).

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetsc...@day.com


Re: SlingPostServlet saves operations that throw an error in the log but return 200 responses

2010-04-01 Thread Michael Yin
Just tested this. setting ":status" to "standard" still resulted in a 200 OK
response.

-mike

On Wed, Mar 31, 2010 at 9:01 AM, Michael Yin  wrote:

> I will try setting :status to "standard" and see what happens. However,
> currently I have not set it at all.
>
> -mike
>
>
> On Wed, Mar 31, 2010 at 4:46 AM, Alexander Klimetschek 
> wrote:
>
>> On Wed, Mar 31, 2010 at 03:06, Michael Yin  wrote:
>> > I would argue that errors should be given an appropriate response. Most
>> of
>> > the other actions that I've seen return appropriate error responses,
>> such as
>> > doing xpath searches with improper syntax returns a 500 or when a
>> resource
>> > isn't found, returning a 404. You can still output HTML with a non-200
>> > response. Otherwise it just seems inconsistent.
>>
>> By default, http error codes should be set. This behavior can be
>> controlled via the ":status" parameter.
>>
>>
>> http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html#ManipulatingContent-TheSlingPostServlet%2528servlets.post%2529-%257B%257B%253Astatus%257D%257D
>>
>> The reason for having 200's in some cases is when using ajax/iframe
>> requests from browsers, where non-200 responses might get lost.
>>
>> Regards,
>> Alex
>>
>> --
>> Alexander Klimetschek
>> alexander.klimetsc...@day.com
>>
>
>