1 16 17 package org.apache.cocoon; 18 19 import org.apache.avalon.framework.logger.AbstractLogEnabled; 20 import org.apache.cocoon.environment.Environment; 21 import org.apache.cocoon.environment.ObjectModelHelper; 22 import org.apache.cocoon.environment.Request; 23 24 31 public class SampleRequestListener extends AbstractLogEnabled implements RequestListener { 32 33 47 public void onRequestStart(Environment environment){ 48 Request req = ObjectModelHelper.getRequest(environment.getObjectModel()); 49 getLogger().info(req.getRequestURI() + " started"); 50 } 51 52 58 public void onRequestEnd(Environment environment) { 59 Request req = ObjectModelHelper.getRequest(environment.getObjectModel()); 60 getLogger().info(req.getRequestURI() + " ended"); 61 } 62 68 public void onRequestException(Environment environment, Throwable throwable) { 69 Request req = ObjectModelHelper.getRequest(environment.getObjectModel()); 70 getLogger().info(req.getRequestURI() + " failed with " + throwable.getMessage()); 71 } 72 } 73 74 | Popular Tags |