cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Unico Hommes" <Un...@hippo.nl>
Subject RE: [Vote] empty HTTP responses [was Re: Cannot easily set http status]
Date Wed, 05 Nov 2003 11:58:58 GMT
 

> 
> -----Original Message-----
> From: Stefano Mazzocchi [mailto:stefano@apache.org] 
> Sent: woensdag 5 november 2003 12:42
> To: dev@cocoon.apache.org
> 
> 
> On Wednesday, Nov 5, 2003, at 12:19 Europe/Rome, Unico Hommes wrote:
> 
> > setStatus' friends the sendError brothers are also be 
> eligible for FOM 
> > membership. But this change has a dependency on the 
> discussion about 
> > bodyless responses since if you'd do a sendError from a flow script 
> > and then send a page afterwards this would result in errors.
> 
> I dislikde "sendError" because, in fact, HTTP does not have 
> the concept of errors, but only status codes and 
> empty-payload responses.
> 

The only thing is that sendError method allows to set a message as well,
whereas the setStatus equivalent for that has been deprecated as of
servlet spec version 2.1 . According to the servlet spec there is
another difference between sendError and setStatus. From the
HttpResponse.sendError() api doc entry: "After using this method, the
response should be considered to be committed and should not be written
to." For setStatus this is not specified.

Is there no way to set a response message and not commit the response at
the same time? How can we fake this?

> In the future, it's entirely possible to have a 309 or 
> equivalent that is not an error, but has a empty-payload 
> response. I would dislike to call "sendError()" to send 
> something that is not an error, feels hacky.
> 
> I think the optimal solution is:
> 
>   1) add response.setStatus() in FOM
>   2) allow the flowscript to terminate without calling 
> sendPage* [thus resulting in an empty payload]
> 
> Vote?
> 

+1

> --
> Stefano.
> 
> 
> 

Mime
View raw message