home *** CD-ROM | disk | FTP | other *** search
- package org.apache.cocoon.samples.jms;
-
- import java.net.HttpURLConnection;
- import java.net.URL;
- import java.net.URLEncoder;
- import org.hsqldb.Trigger;
-
- public class HTTPTrigger implements Trigger {
- protected String protocol = "http";
- protected String hostname = "localhost";
- protected int port = 8888;
- protected String path = "/samples/jms/database/jms-invalidate";
-
- public void fire(String triggerName, String tableName, Object[] row) {
- try {
- HttpURLConnection con = (HttpURLConnection)(new URL(this.protocol, this.hostname, this.port, this.path + "?trigger=" + URLEncoder.encode(triggerName.toLowerCase()) + "&table=" + URLEncoder.encode(tableName.toLowerCase()))).openConnection();
- con.connect();
- con.getContent();
- con.disconnect();
- } catch (Exception e) {
- throw new RuntimeException("Cannot execute trigger: " + e.getMessage());
- }
- }
- }
-