commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Reilly" <tim.rei...@consultant.com>
Subject [validator] UrlValidator
Date Wed, 28 Jul 2004 15:52:32 GMT
First, I'm a newbie with validator, so maybe I'm just not using it
correctly.
I was hoping to use validator library to validate url strings from a form.
I'm finding the validation too strict for my use case. I have a form and
want to validate the the user entered a valid url in 'simple user' terms of
valid.

But...I added this test case to org.apache.commons.validator.UrlTest; the
url is valid from my POV.

   public void testSanity() {
       UrlValidator v = new UrlValidator();
       assertTrue(v.isValid("http://www.google.com"));
   }

But it fails.

Also testing http://www.google.com with:
isValidScheme : false
isValidAuthority : false
isValidPath : false
isValidQuery : true
isValidFragment: true

Can anyone explain the UrlValidator.isValidXXXXX ?
Why would query and fragment be valid (I guess because they aren't
specified. I'm good with that.)
But can't port and path be optional not specified as well?
Also why is the scheme (http://) not valid?

Oddly, the url http://www.google.com:80/test passes isValid(), but fails
isValidScheme(), etc..

Thanks,
-TR

(btw: Testing against HEAD / 1.1.3)


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message