sunlabs.brazil.proxy

Class JunkBusterHandler

public class JunkBusterHandler extends Object implements Handler

Remove junk images from web pages. This approach is to take all requests for images that look like ads and instead return a dummy bitmap.

Other approaches to removing ads are to filter the HTML returned and (1) remove the ads altogether or (2) change the href in the ads to point to a different bitmap. The advantage of option (2) is that all ads can be changed to point to the same bitmap, increasing the caching performance of the browser.

Properties:

image
The file to contain the replacement image.
host
The regular expression matching url's to reject. If the expression starts with a '@', it interpreted as a file name (minus the @) that contains a new-line separated list of regular exporessions. See Regexp for more information on regular expressions.
Method Summary
booleaninit(Server server, String prefix)
RegexploadUrls(Properties props, String prefix, String file)
booleanrespond(Request request)
booleansendReplacementImage(Request request)

Method Detail

init

public boolean init(Server server, String prefix)

loadUrls

public Regexp loadUrls(Properties props, String prefix, String file)

respond

public boolean respond(Request request)

sendReplacementImage

public boolean sendReplacementImage(Request request)