On 5/23/07, Philip Johnson <[EMAIL PROTECTED]> 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?
Also, don't bake query parameters into the router.attach() pattern. Use the getQueryAsForm() (or whatever it's new name is :-). POSTed values should be put into the passed form, not in the query parameters. Doing so makes them order independent (as per your example) automatically. IIUC your need, the user ID should be in the URL proper since that's what is used to identify the specific resource. I.e., /users/johnm/... Hope this helps, John

