--- Niall Pemberton <[EMAIL PROTECTED]> wrote: > Sorry I jumped the gun and have put up a patch without agreeing the > variable > names - if its not acceptable I can always change it and re-submit the > patch. > > I have used the three options you mention (except mine are currently all > lower case) and a fourth which is "schemes" and it can ccontain a comma > delimited list of valid schemes. > > That covers all the configurable options in UrlValidator. > > 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
How useful is this feature? As a user, I don't care about RFCs or URL validation rules; I just want to know whether I mistyped a URL. David > > > The only thing is how to configure validator to output 16 different > messages? > > > ----- Original Message ----- > From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > To: "Struts Developers List" <[EMAIL PROTECTED]> > Sent: Friday, April 02, 2004 3:01 AM > Subject: Re: Fw: UrlValidator() takes options - but how? > > > > > I was thinking of openning a bugzilla and sticking a patch up - but > I > don't > > > want > > > to steal your thunder if you'd rather do it. > > > > I would encourage a bugzilla ticket, it sounds like there is almost > > agreement on the needed changes, and options. Before fileing do try to > firm > > up those options. Since the commons validator already has the > > allow2slashes,noFragments and allowAllSchemes. These would be a good > start. > > > > > > > > > > > > Niall > > > > > > > > > > > Adam > > > > > > > > On 04/01/2004 10:08 PM Niall Pemberton wrote: > > > > > Adam Hardy suggested "allow2slashes", "nofragments" and > > > "allowallschemes" > > > > > being either true/false > > > > > > > > > > I think rather than having "allowallschemes", have a "schemes" > parameter > > > > > which can be either "all" (which sets the allow all schemes > option) > or a > > > > > comma delimited list of valid schemes. > > > > > > > > > > Alternatively you could have Adam's suggestion plus any <var> > that > > > starts > > > > > with "scheme" is taken to build an array of schemes. Something > like: > > > > > > > > > > <field property="someUrl" depends="myUrlValidator"> > > > > > <var><var-name>allow2slashes</var-name> > > > > > <var-value>true</var-value> > > > > > </var> > > > > > <var><var-name>nofragments</var-name> > > > > > <var-value>true</var-value> > > > > > </var> > > > > > <var><var-name>allowallschemes</var-name> > > > > > <var-value>false</var-value> > > > > > </var> > > > > > <var><var-name>scheme1</var-name> > > > > > <var-value>http</var-value> > > > > > </var> > > > > > <var><var-name>scheme2</var-name> > > > > > <var-value>ftp</var-value> > > > > > </var> > > > > > <var><var-name>scheme3</var-name> > > > > > <var-value>telnet</var-value> > > > > > </var> > > > > > </field> > > > > > > > > > > > > > > > Niall > > > > > > > > > > ----- Original Message ----- > > > > > From: "David Graham" <[EMAIL PROTECTED]> > > > > > To: "Struts Developers List" <[EMAIL PROTECTED]> > > > > > Sent: Thursday, April 01, 2004 8:17 PM > > > > > Subject: Re: Fw: UrlValidator() takes options - but how? > > > > > > > > > > > > > > > > > > > >>--- Niall Pemberton <[EMAIL PROTECTED]> wrote: > > > > >> > > > > >>>Sorry this went to the wrong list, but anyway.... > > > > >>> > > > > >>>Looking at CVS there is a validateUrl() method in the Struts > > > FieldChecks > > > > >>>class (added in version 1.15) - problem is it uses commons > > > > >>>GenericValidator > > > > >>>which has a static instance. > > > > >>> > > > > >>>What do you think about changing this to instantiate a > UrlValidator > if > > > > >>>any > > > > >>>configuration parameters have been enetered in validation.xml, > > > otherwise > > > > >>>use > > > > >>>the GenericValidator? > > > > >> > > > > >>Sounds ok to me but we need to define the variable names the > method > > > > >>recognizes and will use in UrlValidator configuration. > > > > >> > > > > >>David > > > > > > > > -- > > > > 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] > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > 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] > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]