Hi Vincent,

My understanding from WADL is that query parameters always have a value,
probably due to the way HTML forms are encoded. For boolean parameters you
could use 'true/false'. See WADL section 2.8.1.

For matrix parameters, the presence of the parameter gives it a 'true'
value. See section 2.5.1.

Restlet doesn't enforce those rules but I suggest that you follow them
unless you have a good reason not to do so.

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


-----Message d'origine-----
De : Vincent Ricard [mailto:[EMAIL PROTECTED] 
Envoyé : mardi 9 septembre 2008 14:31
À : [email protected]
Objet : Convention and booleans

Hi,

I read the WADL spec and the wadl2java code (which creates the client
stubs from a wadl file).
The generated code seems work like that (for a boolean parameter):
- if the param is true, the name is added (to the matrix or query string)
(with no values);
- if it is false, nothing is added.

I wonder what the expected behavior for a server? Is there some spec or
convention about "how to handle a boolean value from a query
string/matrix?"

For now, i do that, but i'm not sure if it's the right way:
- if the query string does not contain my param, i set my internal
representation to false;
- if the query string contains my param, i set my reprensentation to true.

Should i parse the value too?

Any comments (and pointers) are welcome (and appreciate ;-)

Cheers
-- 
Vincent Ricard

Reply via email to