Hi, Here is an example[1][2] that you may take a look.
[1]http://camel.apache.org/spring-security-example.html [2]https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-spring-security/src/main/webapp/WEB-INF/web.xml -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, February 5, 2013 at 5:56 AM, dvsridhar wrote: > Hi, > We have some security filters that's get executed even before the request > reaches the actual end point. We need to log failed security attempts as > part of the audit log. > > We have some central audit log routes that already does audit logging. What > is the best way to invoke a route from a servlet filter. > > I tried 2 ways and I got Nullpointer exception both the cases. > > *Approach 1:* > > @EndpointInject(uri="jms:queue:com/cgi/fdx/route/audit_log_queue") > private ProducerTemplate producer; > > . > . > producer.sendBody(log); > > *Approach 2* > @Produce(uri = "jms:queue:com/cgi/fdx/route/audit_log_queue") > private AuditProxy audit; > . > . > audit.audit(log); > > *Audit Porxy Interface > ------------- > * > import java.io.Serializable; > import org.apache.camel.InOnly; > @InOnly > public interface AuditProxy extends Serializable{ > public void audit(AuditLog log); > } > > Thanks, > Sridhar > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/calling-camel-route-from-a-Servlet-Filter-tp5726923.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).