I tend to think of query string parameters as "optional" parameters, and usually only used for GET requests.

For example, in a search for resources (returns a list of objects). Maybe my default url looks like this:

/app/users/

I've defined this to return the newest 50 users of the system. However, I've also get some query string parameters to override the default:

/app/users/?page=3&perpage=10&eyecolor=blue&gender=male

Again, these optional parameters can be passed in any order. In order to extract these, you should use a Form class (which can be retrieved from your Request object).

I think generally that query string parameters should only be used in GET requests and only to modify some default behaviors of the representation and/or resource.

Anyway, so check out the Request#getEntityAsForm() method (actually, it's in the Message class which is the parent class of Request). You will have all the query string parameters in the Form.

Hope that helps,

Adam



Philip Johnson wrote:
Adam Taft <adam <at> adamtaft.com> writes:

Is there a particular reason why you are using query string parameters for your post attributes?

Hmm, I guess there's two issues here:

 (1) Is my example appropriate according to REST architectural principles?
 (2) How do you do order-independent multiple parameter processing in Restlet?

You make good points about (1), and I will ponder them.  I am still interested
in the answer to question (2), since I assume that we all agree that REST
architectural principles do not exclude the use of multiple query string
parameters in all situations.

Cheers,
Philip



Reply via email to