RE: On a Resource, when and by what is getRepresentation() called?

2008-09-29 Thread Jerome Louvel
Hi Rob,
 
I'd just like to point out that there are now shortcut Resource#getQuery()
and getMatrix() methods that internally calls
getRequest().getResourceRef().getQueryAsForm().
 
Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~  http://www.restlet.org/
http://www.restlet.org
Noelios Technologies ~ Co-founder ~  http://www.noelios.com/
http://www.noelios.com

  _  

De : Rob Heittman [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 29 septembre 2008 01:40
À : discuss@restlet.tigris.org
Objet : Re: On a Resource, when and by what is getRepresentation() called?


Because the names of the high level methods in 1.0 were confusing, a fair
bit of this was changed for Restlet 1.1.  In 1.1, you are principally
working with represent(...) for GET and acceptRepresentation(...) for POST. 

In either 1.0 or 1.1, the getRequest and getResponse methods allow you to
interact with these objects.
getRequest().getResourceReference().getQueryAsForm() is probably what you
want.

I will pedantically observe that if you are using query strings, you may not
have an optimally resource-oriented API.  Query strings are frequently
(though not always) indicative of an imperative, non-REST design.  If you
already know this and or/don't care, ignore the pedantry ...


- Rob

On Sun, Sep 28, 2008 at 6:38 PM, Mark Petrovic [EMAIL PROTECTED] wrote:


Is it the case that the Resource method public Representation
getRepresentation(Variant variant) is the method to override to handle an
HTTP GET on the resource?  If yes, how would one acquire references to any
parameters to the GET call (e.g., the x and foo in /res?x=foo).  If not,
when is this method called and typically by whom or what?





Re: On a Resource, when and by what is getRepresentation() called?

2008-09-28 Thread Rob Heittman
Because the names of the high level methods in 1.0 were confusing, a fair
bit of this was changed for Restlet 1.1.  In 1.1, you are principally
working with represent(...) for GET and acceptRepresentation(...) for POST.
In either 1.0 or 1.1, the getRequest and getResponse methods allow you to
interact with these objects.
 getRequest().getResourceReference().getQueryAsForm() is probably what you
want.

I will pedantically observe that if you are using query strings, you may not
have an optimally resource-oriented API.  Query strings are frequently
(though not always) indicative of an imperative, non-REST design.  If you
already know this and or/don't care, ignore the pedantry ...

- Rob

On Sun, Sep 28, 2008 at 6:38 PM, Mark Petrovic [EMAIL PROTECTED] wrote:

 Is it the case that the Resource method public Representation
 getRepresentation(Variant variant) is the method to override to handle an
 HTTP GET on the resource?  If yes, how would one acquire references to any
 parameters to the GET call (e.g., the x and foo in /res?x=foo).  If not,
 when is this method called and typically by whom or what?



Re: On a Resource, when and by what is getRepresentation() called?

2008-09-28 Thread Mark Petrovic

I see.  Thank you.

Mark

On Sep 28, 2008, at 4:39 PM, Rob Heittman wrote:

Because the names of the high level methods in 1.0 were confusing, a  
fair bit of this was changed for Restlet 1.1.  In 1.1, you are  
principally working with represent(...) for GET and  
acceptRepresentation(...) for POST.


In either 1.0 or 1.1, the getRequest and getResponse methods allow  
you to interact with these objects.   
getRequest().getResourceReference().getQueryAsForm() is probably  
what you want.


I will pedantically observe that if you are using query strings, you  
may not have an optimally resource-oriented API.  Query strings are  
frequently (though not always) indicative of an imperative, non-REST  
design.  If you already know this and or/don't care, ignore the  
pedantry ...


- Rob

On Sun, Sep 28, 2008 at 6:38 PM, Mark Petrovic  
[EMAIL PROTECTED] wrote:
Is it the case that the Resource method public Representation  
getRepresentation(Variant variant) is the method to override to  
handle an HTTP GET on the resource?  If yes, how would one acquire  
references to any parameters to the GET call (e.g., the x and foo  
in /res?x=foo).  If not, when is this method called and typically by  
whom or what?