Package org.apache.nutch.urlfilter.validator

# Class UrlValidator

java.lang.Object
org.apache.nutch.urlfilter.validator.UrlValidator

All Implemented Interfaces:
  `Configurable`, `URLFilter`, `Pluggable`

public class UrlValidator extends Object implements URLFilter

Validates URLs.

Originally based in on php script by Debbie Dyer, validation.php v1.2b, Date: 03/07/02, http://javascript.internet.com. However, this validation now bears little resemblance to the php original.

       Example of usage:
        UrlValidator urlValidator = UrlValidator.get();
        if (urlValidator.isValid("ftp://foo.bar.com/")) {
           System.out.println("url is valid");
        } else {
           System.out.println("url is invalid");
        }

       prints out "url is valid"

Based on UrlValidator code from Apache commons-validator.

See Also:
  - Uniform Resource Identifiers (URI): Generic Syntax

- ## Field Summary

  ### Fields inherited from interface org.apache.nutch.net.URLFilter

  `X_POINT_ID`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UrlValidator()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `filter(String urlString)`
  Interface for a filter that transforms a URL: it can pass the original URL through or "delete" the URL by returning null
  `Configuration`
  `getConf()`
  `void`
  `setConf(Configuration conf)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### UrlValidator

    public UrlValidator()

- ## Method Details

  - ### filter

    public String filter(String urlString)
    Description copied from interface: `URLFilter`
    Interface for a filter that transforms a URL: it can pass the original URL through or "delete" the URL by returning null
    Specified by:
      `filter` in interface `URLFilter`
    Parameters:
      `urlString` - the URL string the filter is applied on
    Returns:
      the original URL string if the URL is accepted by the filter or null in case the URL is rejected

  - ### getConf

    public Configuration getConf()
    Specified by:
      `getConf` in interface `Configurable`

  - ### setConf

    public void setConf(Configuration conf)
    Specified by:
      `setConf` in interface `Configurable`