The atg.servlet.pagefilter.PageFilterUtil class lets you encode URLs in HTML dynamically. When an HTML file is read from the input stream, the data is written to the response and, at the same time, URLs found in the HTML are replaced with encoded versions. For improved performance, an offset table can be generated the first time a given HTML file is parsed. Subsequent requests use the offset table to locate the URLs.

Any of the following operations can be accomplished by incorporating PageFilterUtil in a JSP tag or custom servlet bean:

You can find PageFilterUtil in <ATG10dir>\DAS\lib\classes.jar so it is appended to your CLASSPATH by default. Design your classes to instantiate and reference PageFilterUtil as needed.

The writeHTMLFile method determines whether the page requires encoding and when needed, accomplishes this task before writing the page content to the response object. When a page does not require any URL Rewriting, page content is sent directly to the browser.

The encodeHTMLFile method calls response.encodeURL for every URL within a given page and writes the resultant page content to the response object. Because pages that do not require parsing and encoding follow the same process as those that do, you ought to use writeHTMLFile to speed page rendering when you are unsure of the content in your pages.

The remaining methods, writeFile, writeByteFile, and writeCharFile, pass a page to the response object directly. These methods assume encoding has already been applied to the page content, however you can specify encoding using these methods in order to parse the page as characters and write out the result through PrintWriter.

For more information see the atg.servlet.pagefilter.PageFilterUtil section of the ATG Platform API Reference.