/* * ReplaceFilter.java * * Brazil project web application toolkit, * export version: 2.3 * Copyright (c) 1999-2009 Sun Microsystems, Inc. * * Sun Public License Notice * * The contents of this file are subject to the Sun Public License Version * 1.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is included as the file "license.terms", * and also available at http://www.sun.com/ * * The Original Code is from: * Brazil project web application toolkit release 2.3. * The Initial Developer of the Original Code is: suhler. * Portions created by suhler are Copyright (C) Sun Microsystems, Inc. * All Rights Reserved. * * Contributor(s): suhler. * * Version: 2.4 * Created by suhler on 99/09/01 * Last modified by suhler on 09/03/27 08:55:47 * * Version Histories: * * 2.4 09/03/27-08:55:47 (suhler) * add "capture" option to retain previous content in a request property * * 2.3 08/12/19-10:45:41 (suhler) * path cache was never set * * 2.2 04/11/30-15:19:39 (suhler) * fixed sccs version string * * 2.1 02/10/01-16:39:02 (suhler) * version change * * 1.8 02/07/24-10:44:03 (suhler) * doc updates * * 1.7 02/04/25-14:10:19 (suhler) * look for file in resource if not found in filesystem * * 1.6 01/02/19-10:46:37 (suhler) * fix bug in "root" computation * * 1.5 00/12/11-13:26:06 (suhler) * add class=props for automatic property extraction * * 1.4 00/11/07-08:55:20 (suhler) * add debug flag to prevent template cacheing * * 1.3 00/05/31-13:44:37 (suhler) * docs * * 1.2 99/10/06-12:30:51 (suhler) * use mimeHeaders * * 1.2 99/09/01-15:35:34 (Codemgr) * SunPro Code Manager data about conflicts, renames, etc... * Name history : 2 1 filter/ReplaceFilter.java * Name history : 1 0 tail/ReplaceFilter.java * * 1.1 99/09/01-15:35:33 (suhler) * date and time created 99/09/01 15:35:33 by suhler * */ package sunlabs.brazil.filter; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import sunlabs.brazil.handler.ResourceHandler; import sunlabs.brazil.server.Request; import sunlabs.brazil.server.Server; import sunlabs.brazil.util.http.MimeHeaders; /** * Filter to replace current content with a static form, or template. * This should be called * the TemplateFilter, but that name's already taken. The content is * replaced by the template lock-stock-and-barrel. Typically, an upstream * filter has extracted the relevent parts of the content, and a down-stream * filter will combine it with the template. * The filename to use for the template * is computed at each request, so it may be modified dynamically. * * The following server properties are used: *