sunlabs.brazil.filter

Class CopyContentFilter

public class CopyContentFilter extends Object implements Filter

Filter to save content (of an entire site) to a disk file. This is used to "steal" other sites. It is expected to be used in conjunction with a {@link sunlabs.brazil.handler.GenericProxyHandler}. Only files that don't already exist on the local file system are saved. Properties:
directoryName
The root in the file system to save the content in

Version: 2.2

Author: Stephen Uhler

Method Summary
byte[]filter(Request request, MimeHeaders headers, byte[] content)
Grab the contents, and save as a file (if file doesn't already exist).
booleaninit(Server server, String prefix)
booleanrespond(Request request)
This is the request object before the content was fetched
booleanshouldFilter(Request request, MimeHeaders headers)
Watch every document that passes by.

Method Detail

filter

public byte[] filter(Request request, MimeHeaders headers, byte[] content)
Grab the contents, and save as a file (if file doesn't already exist). The URL is mapped into a pathname starting from directoryName .

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)
Watch every document that passes by. If the HTTP rerun code is "200", plan to save the content on the local file system.