com.norconex.collector.http.filter.impl
Class RegexURLFilter

java.lang.Object
  extended by com.norconex.importer.filter.AbstractOnMatchFilter
      extended by com.norconex.collector.http.filter.impl.RegexURLFilter
All Implemented Interfaces:
IHttpDocumentFilter, IHttpHeadersFilter, IURLFilter, IXMLConfigurable, IOnMatchFilter, Serializable

public class RegexURLFilter
extends AbstractOnMatchFilter
implements IURLFilter, IHttpDocumentFilter, IHttpHeadersFilter, IXMLConfigurable

Filters URL based on a regular expression.

XML configuration usage:

  <filter class="com.norconex.collector.http.filter.impl.RegexURLFilter"
          onMatch="[include|exclude]" 
          caseSensitive="[false|true]" >
      (regular expression)
  </filter>
 

Author:
Pascal Essiembre
See Also:
Serialized Form

Constructor Summary
RegexURLFilter()
           
RegexURLFilter(String regex)
           
RegexURLFilter(String regex, OnMatch onMatch)
           
RegexURLFilter(String regex, OnMatch onMatch, boolean caseSensitive)
           
 
Method Summary
 boolean acceptDocument(HttpDocument document)
          Whether to accept a HTTP document.
 boolean acceptDocument(String url, HttpMetadata headers)
          Whether to accept a URL HTTP headers.
 boolean acceptURL(String url)
          Whether to accept this URL.
 boolean equals(Object obj)
           
 String getRegex()
           
 int hashCode()
           
 boolean isCaseSensitive()
           
 void loadFromXML(Reader in)
           
 void saveToXML(Writer out)
           
 void setCaseSensitive(boolean caseSensitive)
           
 void setRegex(String regex)
           
 String toString()
           
 
Methods inherited from class com.norconex.importer.filter.AbstractOnMatchFilter
getOnMatch, loadFromXML, saveToXML, setOnMatch
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegexURLFilter

public RegexURLFilter()

RegexURLFilter

public RegexURLFilter(String regex)

RegexURLFilter

public RegexURLFilter(String regex,
                      OnMatch onMatch)

RegexURLFilter

public RegexURLFilter(String regex,
                      OnMatch onMatch,
                      boolean caseSensitive)
Method Detail

getRegex

public String getRegex()
Returns:
the regex

isCaseSensitive

public boolean isCaseSensitive()

setCaseSensitive

public final void setCaseSensitive(boolean caseSensitive)

setRegex

public final void setRegex(String regex)

acceptURL

public boolean acceptURL(String url)
Description copied from interface: IURLFilter
Whether to accept this URL.

Specified by:
acceptURL in interface IURLFilter
Parameters:
url - the URL to accept/reject
Returns:
true if accepted, false otherwise

loadFromXML

public void loadFromXML(Reader in)
Specified by:
loadFromXML in interface IXMLConfigurable

saveToXML

public void saveToXML(Writer out)
               throws IOException
Specified by:
saveToXML in interface IXMLConfigurable
Throws:
IOException

acceptDocument

public boolean acceptDocument(HttpDocument document)
Description copied from interface: IHttpDocumentFilter
Whether to accept a HTTP document.

Specified by:
acceptDocument in interface IHttpDocumentFilter
Parameters:
document - the document to validate
Returns:
true if accepted, false otherwise

acceptDocument

public boolean acceptDocument(String url,
                              HttpMetadata headers)
Description copied from interface: IHttpHeadersFilter
Whether to accept a URL HTTP headers.

Specified by:
acceptDocument in interface IHttpHeadersFilter
Parameters:
url - the URL to accept/reject its headers
headers - HTTP headers associated with the URL
Returns:
true if accepted, false otherwise

toString

public String toString()
Overrides:
toString in class AbstractOnMatchFilter

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractOnMatchFilter

equals

public boolean equals(Object obj)
Overrides:
equals in class AbstractOnMatchFilter


Copyright © 2009-2013 Norconex Inc.. All Rights Reserved.