How do I get the requests for a servlet implementing CometProcessor interface to pass through a filter

StackOverflow https://stackoverflow.com/questions/14577096

Question

I have a servlet implementing CometProcessor and I am trying to get the requests coming to this servlet to pass through a filter. Specifying the servlet in web.xml under does not make the requests to the servlet to pass through the filter. I also tried implementing CometFilter and specified the servlet implementing CometProcessor in web.xml under . I get the following error -

Jan 29, 2013 12:10:04 PM org.apache.catalina.connector.CoyoteAdapter service - SEVERE: An exception or error occurred in the container during the request processing
java.lang.NullPointerException
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:430)
    at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:356)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1534)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Was it helpful?

Solution

Thanks for your inputs, I found out where I am going wrong. I had made a mistake in implementing CometFilter. I read the documentation present in the CometFilter class itself and found that I need to implement doFilterEvent method and not doFilter method. Now its working fine and requests to the servlet implementing CometProcessor are being passed to this filter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top