WebSphere Application Server - Express for i5/OS, Version 6.1   
             オペレーティング・システム: i5/OS

             目次と検索結果のパーソナライズ化

例: com.ibm.websphere.LoggingFilter.java を使用したフィルターの実装

次の例は、フィルターのインプリメント方法を示したものです。

package com.ibm.websphere;

import java.io.*;
import javax.servlet.*;

public class LoggingFilter implements Filter
{
    File _loggingFile = null;

    // implement the required init method
    public void init(FilterConfig fc)
    {
        // create the logging file
        xxx;
    }

    // implement the required doFilter method...this is where most of the work is done
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
{
        try
        {
            // add request info to the log file
            synchronized(_loggingFile)
            {
                xxx;
            }
 
            // pass the request on to the next resource in the chain
            chain.doFilter(request, response);
        }
        catch (Throwable t) {
// handle problem...
        }
    }

    // implement the required destroy method
    public void destroy()
    {
        // make sure logging file is closed
        _loggingFile.close();
    }
}



関連概念
サーブレット・フィルター
関連タスク
WebSphere Application Server の拡張機能を使用したサーブレットの開発
関連資料
Web アプリケーション: 学習用リソース
参照トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 7:05:28 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/xweb_sfilt.html