2010年5月28日金曜日

Google App Engine for Java[実践]クラウドシステム構築」正誤表 第3章

p.86 リスト3.4.1

package mysite.server;

import java.io.IOException;
import java.util.logging.Logger;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class LogFilterImpl implements Filter {

    private FilterConfig filterConfig;

    private static final Logger LOG =
            Logger.getLogger(LogFilterImpl.class.getName());

    @Override
    public void doFilter(ServletRequest request,
                         ServletResponse response,
                         FilterChain filterChain)
            throws IOException, ServletException {
        LOG.info("Log filter processed a " +
                 filterConfig.getInitParameter("logType") +
                 " request");
        filterChain.doFilter(request, response);
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        this.filterConfig = filterConfig;
    }

    @Override
    public void destroy() {
        // no-op
    }
}

0 件のコメント:

コメントを投稿