sunlabs.brazil.filter

Class ReFilter

public class ReFilter extends Object implements Filter

Filter to replace text content via a reqular expression substitution. See Regexp and Regexp.

Note: The regular expression processing should be consolodated with the RePollHandler, and the tag_extract... processing.

The following server properties are used:

re
The regular expression to match the content
sub
The replacement expression. If not specified, the matched content is deleted.
oneOnly
If set, only replace the first match. by default, all matches are replaced.
noCase
If set, case-insensitive matchins is performed.

Version: 2.4

Author: Stephen Uhler

Method Summary
byte[]filter(Request request, MimeHeaders headers, byte[] content)
If the content matches the regular expression, do the substitution.
booleaninit(Server server, String prefix)
booleanrespond(Request request)
This is the request object before the content was fetched
booleanshouldFilter(Request request, MimeHeaders headers)
Only filter text documents

Method Detail

filter

public byte[] filter(Request request, MimeHeaders headers, byte[] content)
If the content matches the regular expression, do the substitution. Otherwise, return the original content un-changed.

init

public boolean init(Server server, String prefix)

respond

public boolean respond(Request request)
This is the request object before the content was fetched

shouldFilter

public boolean shouldFilter(Request request, MimeHeaders headers)
Only filter text documents