/* this belongs to the WebRaveler2.Plugins package */ package webraveler.plugin; import java.util.*; import webraveler.html.HTMLPage2; import webraveler.http.HTTPResponse; import webraveler.ravel.PluginAPI; import webraveler.vurl.InsertAtBottomVURL; /** * A Web Raveler plugin to insert text at the bottom of an * HTML page * * @author The Web Raveler Development Squad * @version 1.0 */ public class InsertAtBottomPlugin extends webraveler.ravel.RavelerPlugin { String htmlToInsert; String fullVURL; /** * */ public InsertAtBottomPlugin() { name = "InsertAtBottomPlugin"; htmlToInsert = "

Chillin' at the bottom!

"; mimeTypes.add("text/html"); } // InsertAtBottomPlugin() /** * */ public boolean initialize() { /* Add a temporary virtual url */ InsertAtBottomVURL vurl = new InsertAtBottomVURL(); return true; } // initialize() /** * */ public HTTPResponse execute(HTTPResponse response, Hashtable attributes) { /* get htmlToInsert from the attributes hash */ htmlToInsert = (String) attributes.get("htmlToInsert"); //System.out.println("InsertAtBottomPlugin: htmlToInsert='" + htmlToInsert + "'"); System.out.println("InsertAtBottomPlugin: Executing..."); System.out.println("InsertAtBottomPlugin: Inserting text..."); /* Use the plugin API method to insert the text at the bottom */ response.getHtmlPage().insertAtBottom(htmlToInsert); response.correctContentLength(); System.out.println("InsertAtBottomPlugin: DONE"); return response; } //execute(HTTPResponse) /** * */ public void terminate() { } // terminate() /** * Return the default configuration for this plugin as a hash table. * */ public void setDefaultAttributes() { attributes = new Hashtable(); attributes.put("htmlToInsert","

Chillin' at the bottom!

"); name = "InsertAtBottomPlugin"; } } // InsertAtBottomPlugin