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 RESULTS] FOM sendStatus/setStatus
Date Wed, 12 Nov 2003 13:05:35 GMT
 

> 
> -----Original Message-----
> From: Unico Hommes 
> Sent: maandag 10 november 2003 12:11
> To: dev@cocoon.apache.org
> 

<snip/>

> Sylvain Wallez wrote:
> > Furthermore, I would like this feature to be defined at the 
> > environment level and not only in the flowscript. Methods of
> the
> > "cocoon" object should just be wrappers around features 
> available also 
> > in regular Java code.
> > 
> 
> These methods already exist on the environment objects:
> 
> See HttpEnvironment.setStatus(), HttpResponse.setStatus() and 
> HttpResponse.sendError().
> 

Hmm. It seems I was wrong on two accounts here. 

First HttpServletResponse.sendError() is specified to send an html error
page. This just means we need to use HttpServletResponse.setStatus().
Only problem is the two argument version -
HttpServletResponse.setStatus(int sc, String msg) - seems to be
deprecated with no replacement!

The http spec does allow for a customized "reason phrase". So why this
was done remains a mystery to me:

-- HTTP/1.1 (RFC 2068) --

6.1.1 Status Code and Reason Phrase

...

The reason phrases listed here are only recommended
   -- they may be replaced by local equivalents without affecting the
   protocol.

          Status-Code    = "100"   ; Continue
                         | "101"   ; Switching Protocols
                         | "200"   ; OK

-- /HTTP/1.1 (RFC 2068) --

What do you think? Should we skip the two argument sendStatus/setStatus
methods? Or should we ignore the deprecated warning from the servlet
api?

The isRedirected flag still needs to be set on the Redirector upon
sendStatus(). We need to decide how. We can do this by specifying null
as the url argument to the redirect methods:

package o.a.c.environment;

interface Redirector {
  
  /**
   * Redirect to the given URL, null only sets the
   * isRedirected flag.
   */
  void redirect(boolean sessionMode, String url);
  
  /**
   * Unconditionally redirect to the given URL, null only
   * sets the isRedirected flag.
   */
  void globalRedirect(boolean sessionMode, String url);

}

Or we can add a special nullRedirect() method.

Thoughts?

Unico

Mime
View raw message