rabbit.filter
Class AdFilter

java.lang.Object
  extended by rabbit.filter.HtmlFilter
      extended by rabbit.filter.AdFilter
All Implemented Interfaces:
HtmlFilterFactory

public class AdFilter
extends HtmlFilter

This class switches advertising images into another image.

Author:
Robert Olofsson

Field Summary
protected static String ADREPLACER
          the image we replace ads with
 
Fields inherited from class rabbit.filter.HtmlFilter
con, request, response
 
Constructor Summary
AdFilter()
           
AdFilter(Connection con, HttpHeader request, HttpHeader response)
          Create a new AdFilter for the given request, response pair.
 
Method Summary
 void filterHtml(HtmlBlock block)
          Removes advertising from the given block.
 boolean isEvil(String str)
          Check if a string is evil (that is its probably advertising).
 HtmlFilter newFilter(Connection con, HttpHeader request, HttpHeader response)
          Get a new HtmlFilter for the given request, response pair.
 
Methods inherited from class rabbit.filter.HtmlFilter
isCacheable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADREPLACER

protected static final String ADREPLACER
the image we replace ads with

See Also:
Constant Field Values
Constructor Detail

AdFilter

public AdFilter()

AdFilter

public AdFilter(Connection con,
                HttpHeader request,
                HttpHeader response)
Create a new AdFilter for the given request, response pair.

Parameters:
request - the actual request made.
response - the actual response being sent.
Method Detail

newFilter

public HtmlFilter newFilter(Connection con,
                            HttpHeader request,
                            HttpHeader response)
Description copied from interface: HtmlFilterFactory
Get a new HtmlFilter for the given request, response pair.

Parameters:
con - the Connection handling the request.
request - the actual request made.
response - the actual response being sent.

filterHtml

public void filterHtml(HtmlBlock block)
Removes advertising from the given block.

Specified by:
filterHtml in class HtmlFilter
Parameters:
block - the part of the html page we are filtering.

isEvil

public boolean isEvil(String str)
Check if a string is evil (that is its probably advertising).

Parameters:
str - the String to check.