Examples of UrlValidator


Examples of org.apache.commons.validator.routines.UrlValidator

    private final UrlValidator urlValidator;

    public WidgetValidator() {
        super();
        RegexValidator regex = new RegexValidator(new String[] {"http", "https","((localhost)(:[0-9]+))"});
        urlValidator = new UrlValidator(regex, 0);
    }
View Full Code Here

Examples of org.apache.commons.validator.routines.UrlValidator

    * Testing the same method of URL validator used in validate method. Its was really hard to create Error object
    */
@Test
public void testValidation() throws Exception {
      RegexValidator regex = new RegexValidator(new String[]{"http","https","((localhost)(:[0-9]+))",".*\\.linux-server(:[0-9]+)"});
      UrlValidator validator = new UrlValidator(regex, 0);
      assertTrue("localhost URL should validate",
                validator.isValid("http://localhost:8080/demogadgets/CTSSResourcesMapView.xml"));
        assertTrue("127.0.0.1 should validate",
                validator.isValid("http://127.0.0.1:8080/demogadgets/CTSSResourcesMapView.xml"));
        assertTrue("my.linux-server should validate",
                validator.isValid("http://my.linux-server:8080/demogadgets/CTSSResourcesMapView.xml"));

        assertFalse("broke.my-test should not validate",
                validator.isValid("http://broke.my-test/test/index.html"));

        assertTrue("www.apache.org should still validate",
                validator.isValid("http://www.apache.org/test/index.html"));
    }
View Full Code Here

Examples of org.apache.commons.validator.routines.UrlValidator

     */
    protected static URL getLicenseURL( MavenProject project, String url )
        throws IOException
    {
        URL licenseUrl = null;
        UrlValidator urlValidator = new UrlValidator( UrlValidator.ALLOW_ALL_SCHEMES );
        // UrlValidator does not accept file URLs because the file
        // URLs do not contain a valid authority (no hostname).
        // As a workaround accept license URLs that start with the
        // file scheme.
        if ( urlValidator.isValid( url ) || StringUtils.defaultString( url ).startsWith( "file://" ) )
        {
            try
            {
                licenseUrl = new URL( url );
            }
View Full Code Here

Examples of org.apache.nutch.urlfilter.validator.UrlValidator

  /**
   * Test method for {@link org.apache.nutch.urlfilter.validator.UrlValidator#filter(java.lang.String)}.
   */
  @Test
  public void testFilter() {
    UrlValidator url_validator = new UrlValidator();
    Assert.assertNotNull(url_validator);

    Assert.assertNull("Filtering on a null object should return null", url_validator.filter(null));
    Assert.assertNull("Invalid url: example.com/file[/].html", url_validator.filter("example.com/file[/].html"));
    Assert.assertNull("Invalid url: http://www.example.com/space here.html", url_validator.filter("http://www.example.com/space here.html"));
    Assert.assertNull("Invalid url: /main.html", url_validator.filter("/main.html"));
    Assert.assertNull("Invalid url: www.example.com/main.html", url_validator.filter("www.example.com/main.html"));
    Assert.assertNull("Invalid url: ftp:www.example.com/main.html", url_validator.filter("ftp:www.example.com/main.html"));
    Assert.assertNull("Inalid url: http://999.000.456.32/nutch/trunk/README.txt",
        url_validator.filter("http://999.000.456.32/nutch/trunk/README.txt"));
    Assert.assertNull("Invalid url: http://www.example.com/ma|in\\toc.html", url_validator.filter(" http://www.example.com/ma|in\\toc.html"));

    Assert.assertNotNull("Valid url: https://issues.apache.org/jira/NUTCH-1127", url_validator.filter("https://issues.apache.org/jira/NUTCH-1127"));
    Assert.assertNotNull("Valid url: http://domain.tld/function.cgi?url=http://fonzi.com/&name=Fonzi&mood=happy&coat=leather",
        url_validator.filter("http://domain.tld/function.cgi?url=http://fonzi.com/&name=Fonzi&mood=happy&coat=leather"));
    Assert.assertNotNull("Valid url: http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Ffeeds.feedburner.com%2Fperishablepress",
        url_validator.filter("http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Ffeeds.feedburner.com%2Fperishablepress"));
    Assert.assertNotNull("Valid url: ftp://alfa.bravo.pi/foo/bar/plan.pdf", url_validator.filter("ftp://alfa.bravo.pi/mike/check/plan.pdf"));

  }
View Full Code Here

Examples of org.apache.nutch.urlfilter.validator.UrlValidator

  /**
   * Test method for {@link org.apache.nutch.urlfilter.validator.UrlValidator#filter(java.lang.String)}.
   */
  public void testFilter() {
    UrlValidator url_validator = new UrlValidator();
    assertNotNull(url_validator);

    assertNull("Filtering on a null object should return null", url_validator.filter(null));
    assertNull("Invalid url: example.com/file[/].html", url_validator.filter("example.com/file[/].html"));
    assertNull("Invalid url: http://www.example.com/space here.html", url_validator.filter("http://www.example.com/space here.html"));
    assertNull("Invalid url: /main.html", url_validator.filter("/main.html"));
    assertNull("Invalid url: www.example.com/main.html", url_validator.filter("www.example.com/main.html"));
    assertNull("Invalid url: ftp:www.example.com/main.html", url_validator.filter("ftp:www.example.com/main.html"));
    assertNull("Inalid url: http://999.000.456.32/nutch/trunk/README.txt",
        url_validator.filter("http://999.000.456.32/nutch/trunk/README.txt"));
    assertNull("Invalid url: http://www.example.com/ma|in\\toc.html", url_validator.filter(" http://www.example.com/ma|in\\toc.html"));

    assertNotNull("Valid url: https://issues.apache.org/jira/NUTCH-1127", url_validator.filter("https://issues.apache.org/jira/NUTCH-1127"));
    assertNotNull("Valid url: http://domain.tld/function.cgi?url=http://fonzi.com/&name=Fonzi&mood=happy&coat=leather",
        url_validator.filter("http://domain.tld/function.cgi?url=http://fonzi.com/&name=Fonzi&mood=happy&coat=leather"));
    assertNotNull("Valid url: http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Ffeeds.feedburner.com%2Fperishablepress",
        url_validator.filter("http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Ffeeds.feedburner.com%2Fperishablepress"));
    assertNotNull("Valid url: ftp://alfa.bravo.pi/foo/bar/plan.pdf", url_validator.filter("ftp://alfa.bravo.pi/mike/check/plan.pdf"));

  }
View Full Code Here

Examples of org.apache.wicket.validation.validator.UrlValidator

*/
public class ParsleyUrlValidator extends ParsleyValidationBehavior<String>
{
  public ParsleyUrlValidator()
  {
    super(new UrlValidator());

    require(true);
    type("urlstrict");
  }
View Full Code Here

Examples of org.apache.wicket.validation.validator.UrlValidator

   * @param model
   *            the input value
   */
  public UrlTextField(String id, IModel<String> model)
  {
    this(id, model, new UrlValidator());
  }
View Full Code Here

Examples of org.apache.wicket.validation.validator.UrlValidator

        form.add(new Label("service.enabled", new StringResourceModel("service.enabled", this, null, new Object[]{
            getServiceName()
        })));
        form.add(new TextField("maintainer"));
        TextField onlineResource = new TextField("onlineResource");
        onlineResource.add(new UrlValidator());
        form.add(onlineResource);
        form.add(new CheckBox("enabled"));
        form.add(new CheckBox("citeCompliant"));
        form.add(new TextField("title"));
        form.add(new TextArea("abstract"));
View Full Code Here

Examples of org.apache.wicket.validation.validator.UrlValidator

        ));

        final TextField href = new TextField("wms.attribution.href",
            new PropertyModel(model, "attribution.href")
        );
        href.add(new UrlValidator());
        href.setOutputMarkupId(true);
        add(href);

        final TextField logo = new TextField("wms.attribution.logo",
            new PropertyModel(model, "attribution.logoURL")
        );
        logo.add(new UrlValidator());
        logo.setOutputMarkupId(true);
        add(logo);

        final TextField type = new TextField("wms.attribution.type",
            new PropertyModel(model, "attribution.logoType")
View Full Code Here

Examples of org.apache.wicket.validation.validator.UrlValidator

                item.add(urlBorder);
                TextField format = new TextField("format", new PropertyModel(item.getModel(), "type"));
                format.setRequired(true);
                item.add(format);
                TextField url = new TextField("metadataLinkURL", new PropertyModel(item.getModel(), "content"));
                url.add(new UrlValidator());
                url.setRequired(true);
                urlBorder.add(url);
               
                // remove link
                AjaxLink link = new AjaxLink("removeLink", item.getModel()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.