Niall, have a look at org.apache.commons.validator.util.Flags to see how it's done.
Adam
On 04/02/2004 09:50 PM Niall Pemberton wrote:
I'll have a look a doing a patch. I'm probably being really stupid but how do you mean group by powers of 2? You mean 1, 2, 4, 8, 16, 32, 64 etc. - but how would it group?
Niall
----- Original Message ----- From: "Robert Leland" <[EMAIL PROTECTED]>
To: "Struts Developers List" <[EMAIL PROTECTED]>
Sent: Friday, April 02, 2004 7:37 PM
Subject: Re: Fw: UrlValidator() takes options - but how?
Comments In Line.
-----Original Message----- From: Niall Pemberton [mailto:[EMAIL PROTECTED]> While I
was testing this I did have another thought - UrlValidator just
returns true or false when it validates and gives no indication of what
bit
of the validation failed. What do you think of changing it so it returns some kind of error code so that a more meaningful message could be
returned
to the user?
Something like
Code Condition 0 valid 101 Invalid Characters 102 Invalid Structure
201 Invalid Scheme Format 202 Invalid Scheme Value (show valid scheme values)
301 Invalid Authority Format 302 Invalid Authority IP Address 303 Invalid Authority Host Name 304 Invalid Authority - not IP Address or Hostname 305 Invalid Port
401 Invalid Path Format 402 Invalid Path - ends with / 403 Invalid Path - two slashes not allowed 404 Invalid Path - slashes/dots
501 Invalid Query format
601 Fragment Not Allowed
The only thing is how to configure validator to output 16 different messages?
Given that fits with the Validator framework, I know its implementation
would be easy. The grouping of error message is also nice.
Since we could use an int/long then I would probably group items by powers
of two, but thats just a preference. If you have already created a patch with the above scheme I would commit it unchanged.
-Rob
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- struts 1.2 + tomcat 5.0.19 + java 1.4.2 Linux 2.4.20 Debian
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]