Package org.apache.commons.validator.routines

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


  /*
    * 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"));
View Full Code Here


    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

    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

  /*
    * 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"));
View Full Code Here

    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

  /*
    * 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"));
View Full Code Here

  /*
    * 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"));
View Full Code Here

    UrlValidator urlValidator;

    public void init(FilterConfig filterConfig) throws ServletException {
        String[] schemes = {"http","https"};
        RegexValidator authorityValidator = new RegexValidator("^([\\p{Alnum}\\-\\.]*)(:\\d*)?(.*)?", false);
        urlValidator = new UrlValidator(schemes, authorityValidator, UrlValidator.ALLOW_LOCAL_URLS);
    }
View Full Code Here

    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

TOP

Related Classes of org.apache.commons.validator.routines.RegexValidator

Copyright © 2018 www.massapicom. 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.