• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Mike London

Tomcat 4.0 problem with Filter class

Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't compile the following file
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
import javax.servlet.ServletException;
public class SimpleFilter implements Filter
private FilterConfig filterConfig;
public void doFilter (ServletRequest request,
ServletResponse response,
FilterChain chain)
chain.doFilter (request, response);
} catch (IOException io) {
System.out.println ("IOException raised in SimpleFilter");
} catch (ServletException se) {
System.out.println ("ServletException raised in SimpleFilter");
public FilterConfig getFilterConfig()
return this.filterConfig;
public void setFilterConfig (FilterConfig filterConfig)
this.filterConfig = filterConfig;
I am using Jdk 1.4. and the servlet.jar ( from tomcat 4.0 ) is in the classpath.
I unjar servlet.jar and found out that in this jar file Filer class is defined as:
package javax.servlet;
// Imports
import javax.servlet.ServletException;
import javax.servlet.FilterConfig;
import javax.servlet.FilterChain;
import javax.servlet.ServletResponse;
import java.io.IOException;
import javax.servlet.ServletRequest;
public abstract interface Filter {
// Methods
void destroy();
void doFilter(ServletRequest p0, ServletResponse p1,
FilterChain p2) throws IOException, ServletException;
void init(FilterConfig p0) throws ServletException;
From servlet spec. we don't have to implement

we only need to implement

My question:
What do I need to do in order to write servlet using new features in spect 2.3 such as Filter to run under tomcat?

Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic