Hi Schley,

As Thierry said, we do want to make sure the developer understands what's
going on. But, there is a way in Restlet to deal with all three uniformly. 

In Restlet 1.1, it was a bit hidden as you need to look at the Route
instance returned when you call attach*() methods on a Router. In Restlet
2.0 you have a new org.restlet.routing.Extractor filter.

Both classes have those methods:
 - extractCookie(String attribute, String cookieName, boolean first)
 - extractEntity(String attribute, String parameter, boolean first)
 - extractQuery(String attribute, String parameter, boolean first)

Once this filter is called, it extracts specified cookies, query and entity
params into the request attributes which can be processed uniformly down the
road by your resource classes.

Does it solve your issue better?

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : Schley Andrew Kutz [mailto:sak...@gmail.com] 
Envoyé : vendredi 19 juin 2009 13:41
À : discuss@restlet.tigris.org
Objet : Re: How do I get the contents of POST variables?

I thought that the entity is what I should be looking at, thanks!

I know that they are different, but some frameworks already provide a  
single call to fetch the data, and I have found it useful in the past.

-- 
-a

"Ideally, a code library must be immediately usable by naive  
developers, easily customized by more sophisticated developers, and  
readily extensible by experts." -- L. Stein

On Jun 19, 2009, at 5:08 AM, Thierry Boileau wrote:

> Hello,
>
> if "entity" is the Representation sent via the POST request, you can
> parse it with a Form as follow:
> Form form = new Form(entity);
>
> If you want to get the cookies values, just call request#getCookies.
>
> For sure, there is a real distinction between the query part of an URI
> and the content of POSTed entity.
> The query is part of the identifier of the resource. An entity sent  
> via
> a POST is a set of data that the resource is asked to take into  
> account
> in order to act on its current state.
> It seems preferable keep this distinction.
>
> best regards,
> Thierry Boileau
>> I can get GET variables via the getQueryAsForm method for a resource
>> reference, but how do I get POST variables? Also, it would be nice to
>> have a getVariable() method that returned a series comprised of GET,
>> POST, and COOKIE keys and values.
>>
>> Thanks!
>>
>>
>
> ------------------------------------------------------
>
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=23634
64

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=23634
89

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2363631

Reply via email to