MyServlet.java Source code

Java tutorial

Introduction

Here is the source code for MyServlet.java

Source

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class MyServlet implements Filter {

    FilterConfig config;

    public void init(FilterConfig config) {

    }

    public void setFilterConfig(FilterConfig config) {
        this.config = config;
    }

    public FilterConfig getFilterConfig() {
        return config;
    }

    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) {
        //    ServletContext context = getFilterConfig().getServletContext();
        //  long bef = System.currentTimeMillis();
        //chain.doFilter(req, res); // no chain parameter needed here
        //    long aft = System.currentTimeMillis();
        //context.log("Request to " + req.getRequestURI() + ": " +(aft-bef));

        System.out.println("logging");
    }

    public void destroy() {
    }
}