I don't know what the 1.0.0 snapshot javadocs have in them so ignore this if 
it's already addressed, but message.getAttributes() make no mentions of being 
able to retrieve http headers nor what one uses for the key name (I'm guessing 
the header name, but it'd be nice if the docs say so).  

It'd also be nice if the methods that wrap access to the headers were more 
explicit about what headers they manipulate.

I'm also a little puzzled at the idea of considering headers as lower-level 
artifacts; it seems to me that, http being an application protocol, the headers 
are first-class citizens.  When I'm attempting to implement a spec that's based 
on http and it says that such-and-such a header must be set, then that's an 
important thing for me to be able to do.

I'd also argue that it's a waste of time to try to make Restlets protocol 
agnostic.  While REST certainly doesnt specify an application protocol, at this 
point there is only one and http is it.  Google around for leaky abstractions 
and protocol independence.  You'll find that true protocol-independence is 
rarely acheived and almost always costs more than its worth in additional 
complexity.  (For example, how would you support an underlying protocol that 
doesn't have the concept of redirection - all those redirect methods become 
pretty useless.)

But hey - you guys are the ones doing the work, so I'm not going to complain 
too loudly.

--Chuck 

-----Original Message-----
From: Jerome Louvel [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 12, 2007 4:38 AM
To: [email protected]
Subject: RE: Re: Response Headers


Hi Chuck,

All standard HTTP headers have an equivalent class/property in the Restlet API. 
It was a deliberate choice to not expose those headers as first-class citizens, 
because we consider them as lower-level artifacts and because we want to 
support multiple protocols via the same API. 

However, you do have access to those raw headers via the request.attributes 
property. You can also add non standard HTTP headers if required. See the 
Javadocs for details:
http://www.restlet.org/docs/api/org/restlet/data/Message.html#getAttributes(
)

Best regards,
Jerome  

> -----Message d'origine-----
> De : Chuck Hinson [mailto:[EMAIL PROTECTED] Envoyé : lundi 12 
> février 2007 06:36 À : [email protected] Objet : RE: Re: 
> Response Headers
> 
> Umm.  OK, thanks.  Not was I was expecting, but I'll take it.
> 
> However, the more generic question is then how do I set an arbitrary 
> HTTP header (entity or response) on a response?
> 
> --Chuck
> 
> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Vincent
> Sent: Sunday, February 11, 2007 8:51 PM
> To: [email protected]
> Subject: Re: Response Headers
> 
> 
> 
> > Maybe I'm blind, but I don't see how to set a header in a response.
> > 
> > I need to set the Location header on a response to a POST,
> but I can't
> 
> > seem to find the right place to do that.  What am I missing?
> 
> 
>  response.setStatus(Status.SUCCESS_CREATED);
>  response.setRedirectRef(request.getRootRef() + <uri>);
> 
> -Vincent.

Reply via email to