Is there a particular reason why you are using query string parameters
for your post attributes?
Traditionally, when you POST a resource (in your case, a user) to a
server, you use the message body to store the data. For example, when a
web browser posts a form to a web server, it encodes the form in
application/x-www-form-urlencoding or multipar/form-data format. It
doesn't have to be this formatting though, it could be something
entirely different (xml, plain text, json, etc.).
The point is, the content of the post goes into the body of the message,
not in a query string parameter. In your example, I would be POSTing
(or PUTting) to /testapplication/users/
By doing this, you don't have to worry about the ordering of your query
string parameters. Maybe there's a specific reason why you're needing
to pass the resource data in the query string?
Adam
Philip Johnson wrote:
Greetings, Restletfarians,
Today I was implementing a handler for a POST method for a Users resource that
takes an email parameter such as:
testapplication/[EMAIL PROTECTED]
I handled this using a router and a URI pattern, as follows:
router.attach("/users?email={email}", UsersResource.class);
This works fine, but now I'm nervous about the case of multiple parameters.
Let's say I want to add a timezone parameter for this user:
testapplication/[EMAIL PROTECTED]&timezone=HST
I could handle this as follows:
router.attach("/users?email={email}&timezone={timezone}",
UsersResource.class);
But then I've hardwired the ordering and the following request would apparently
fail:
testapplication/users?timezone=HST&[EMAIL PROTECTED]
I checked the JavaDoc for the Router class and it was not forthcoming on this
issue. Could someone enlighten me as the appropriate way to handle parameters
in an order-independent fashion?
Thanks,
Philip