That looks OK; perhaps you didn't deploy the filter class correctly? You
need to go through your Tomcat logs and find out what prevented it from
starting up.
L.
enthucoder wrote:
Hi,
I am testing a Servlet Filter usage. And somehow, my application doesn't
even start in Tomcat 5.5. Please help me in debugging, where I am going
wrong.
Here is what did:
SampleFilter.java
package app;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class SampleFilter implements Filter {
private FilterConfig config = null;
public void init(FilterConfig config) throws ServletException {
this.config = config;
}
public void destroy() {
// config = null;
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException
{
// creating a dummy session to check if i am hitting it
HttpSession session =((HttpServletRequest) request).getSession( );
session.setAttribute("ReallyValue", "Testesttest");
chain.doFilter(request, response);
}
}
Snippet from web.xml that i added:
<filter>
<filter-name> SampleFilter </filter-name>
<filer-class> app.SampleFilter </filer-class>
</filter>
<filter-mapping>
<filter-name> SampleFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]