<?xml version="1.0" encoding="Shift_JIS"?>

<!DOCTYPE document SYSTEM "./dtd/document-v10.dtd">

<document>
  <header>
    <title>設定 Howto/Configuration Howto</title>
    <authors>
      <person name="Vincent Massol" email="vmassol@apache.org"/>
    </authors>
    <translators><person name="漆島賢二"/></translators>
  </header>

  <body>

    <s1 title="設定ファイル/The configuration files">

      <note>
        You should read the <link href="getting_started.html">Getting
        Started</link> guide first.
      </note>
      <note>
	まず最初に、
	<link href="getting_started.html">さあ始めよう</link>のガイドをご覧ください。
      </note>

      <p>
        Here are the configuration files used by Cactus :
      </p>
      <p>
        Cactus で使用される設定ファイルは次の通りです :
      </p>

      <figure src="images/config.jpg" alt="Configuration files"/>

      <p>
        There are two kind of configuration files :
      </p>
      <p>
        2 種類の設定ファイルがあります :
      </p>
      <ul>
        <li>
          <jump anchor="clientside">Client side configuration files</jump>
        </li>
        <li>
          <jump anchor="clientside">クライアント側設定ファイル</jump>
        </li>
        <li>
          <jump anchor="serverside">Server side configuration files</jump>
        </li>
        <li>
          <jump anchor="serverside">サーバ側設定ファイル</jump>
        </li>
      </ul>

      <anchor id="clientside"/>
      <s2 title="クライアント側設定ファイル/Client side configuration files">

        <s3 title="cactus.properties">

          <p>
            The <code>cactus.properties</code> file contains several
            configuration properties for Cactus.
          </p>
          <p>
            <code>cactus.properties</code> ファイルには、
	    Cactus の設定プロパティが幾つかあります。
          </p>
          <p>
            Here are the properties that you can set in
            <code>cactus.properties</code> :
          </p>
          <p>
            <code>cactus.properties</code> で設定できるプロパティは次の通りです : 
          </p>

          <table>
            <tr>
              <td>
                <strong>Property Name</strong>
              </td>
              <td>
         Example       <code>cactus.contextURL</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>Description</strong>
              </td>
              <td>
                Webapp Context under which the application to test runs.
              </td>
            </tr>
            <tr>
              <td>
                <strong>Example</strong>
              </td>
              <td>
                <code>cactus.contextURL = http://localhost:8080/test</code>
              </td>
            </tr>
          </table>

          <table>
            <tr>
              <td>
                <strong>プロパティ名</strong>
              </td>
              <td>
                <code>cactus.contextURL</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>説明</strong>
              </td>
              <td>
	 	テストすべきアプリケーションが実行されるウェブアプリケーションのコンテキスト
              </td>
            </tr>
            <tr>
              <td>
                <strong>例</strong>
              </td>
              <td>
                <code>cactus.contextURL = http://localhost:8080/test</code>
              </td>
            </tr>
          </table>

          <p>
            <br/>
          </p>

          <table>
            <tr>
              <td>
                <strong>Property Name</strong>
              </td>
              <td>
                <code>cactus.servletRedirectorName</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>Description</strong>
              </td>
              <td>
                Name of the Cactus Servlet Redirector as it is mapped on the
                server side in <code>web.xml</code> (see below). This property
                is needed only if your test classes are extending
                <code>ServletTestCase</code> (see the
                <link href="howto_testcase.html">TestCase Howto</link>
                tutorial).
              </td>
            </tr>
            <tr>
              <td>
                <strong>Example</strong>
              </td>
              <td>
                <code>cactus.servletRedirectorName = ServletRedirector</code>
              </td>
            </tr>
          </table>

          <table>
            <tr>
              <td>
                <strong>プロパティ名</strong>
              </td>
              <td>
                <code>cactus.servletRedirectorName</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>説明</strong>
              </td>
              <td>
	        サーバ側の <code>web.xml</code> ファイルにおいてマップされる
		Cactus サーブレットリダイレクタの名前。(下を参照)
		自分のテストクラスが
		<code>ServletTestCase</code> を拡張したものである時、
		このプロパティは必要です。
		(<link href="howto_testcase.html">テストケース Howto</link>
		のチュートリアルをご覧ください)
              </td>
            </tr>
            <tr>
              <td>
                <strong>例</strong>
              </td>
              <td>
                <code>cactus.servletRedirectorName = ServletRedirector</code>
              </td>
            </tr>
          </table>

          <p>
            <br/>
          </p>

          <table>
            <tr>
              <td>
                <strong>Property Name</strong>
              </td>
              <td>
                <code>cactus.jspRedirectorName</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>Description</strong>
              </td>
              <td>
                Name of the Cactus JSP Redirector as it is mapped on the
                server side in <code>web.xml</code> (see below). This property
                is needed only if your test classes are extending
                <code>JspTestCase</code> (see the
                <link href="howto_testcase.html">TestCase Howto</link>
                tutorial).
              </td>
            </tr>
            <tr>
              <td>
                <strong>Example</strong>
              </td>
              <td>
                <code>cactus.jspRedirectorName = JspRedirector</code>
              </td>
            </tr>
          </table>

          <table>
            <tr>
              <td>
                <strong>プロパティ名</strong>
              </td>
              <td>
                <code>cactus.jspRedirectorName</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>説明</strong>
              </td>
              <td>
		サーバ側の <code>web.xml</code> ファイルにおいてマップされる
		Cactus JSP リダイレクトの名前。(下を参照)
		自分のテストクラスが
		<code>JspTestClass</code>を拡張したものである時、
		このプロパティは必要です。
		(<link href="howto_testcase.html">テストケース Howto</link>
		のチュートリアルをご覧ください)
              </td>
            </tr>
            <tr>
              <td>
                <strong>例</strong>
              </td>
              <td>
                <code>cactus.jspRedirectorName = JspRedirector</code>
              </td>
            </tr>
          </table>

          <p>
            <br/>
          </p>

          <table>
            <tr>
              <td>
                <strong>Property Name</strong>
              </td>
              <td>
                <code>cactus.filterRedirectorName</code> (For J2EE API 1.3 only)
              </td>
            </tr>
            <tr>
              <td>
                <strong>Description</strong>
              </td>
              <td>
                Name of the Cactus Filter Redirector as it is mapped on the
                server side in <code>web.xml</code> (see below). This property
                is needed only if your test classes are extending
                <code>FilterTestCase</code> (see the
                <link href="howto_testcase.html">TestCase Howto</link>
                tutorial).
              </td>
            </tr>
            <tr>
              <td>
                <strong>Example</strong>
              </td>
              <td>
                <code>cactus.filterRedirectorName = FilterRedirector</code>
              </td>
            </tr>
          </table>

          <table>
            <tr>
              <td>
                <strong>プロパティ名</strong>
              </td>
              <td>
                <code>cactus.filterRedirectorName</code> (J2EE API 1.3 のみ対応)
              </td>
            </tr>
            <tr>
              <td>
                <strong>説明</strong>
              </td>
              <td>
		サーバ側の <code>web.xml</code> ファイルにおいてマップされる
		Cactus フィルターリダイレクタの名前。(下を参照)
		自分のテストクラスが
		<code>FilterTestClass</code>を拡張したものである時、
		このプロパティは必要です。
		(<link href="howto_testcase.html">テストケース Howto</link>
		のチュートリアルをご覧ください)
              </td>
            </tr>
            <tr>
              <td>
                <strong>例</strong>
              </td>
              <td>
                <code>cactus.filterRedirectorName = FilterRedirector</code>
              </td>
            </tr>
          </table>

          <p>
            <br/>
          </p>

          <table>
            <tr>
              <td>
                <strong>Property Name</strong>
              </td>
              <td>
                <code>cactus.enableLogging</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>Description</strong>
              </td>
              <td>
                If set to "true" Cactus internal logging is enabled. Note that
                you will also need <code>log4j.jar</code> in your classpath to
                activate logging. If not specified or set to a value different
                than "true", Cactus logging is disabled.
              </td>
            </tr>
            <tr>
              <td>
                <strong>Example</strong>
              </td>
              <td>
                <code>cactus.enableLogging = true</code>
              </td>
            </tr>
          </table>

          <table>
            <tr>
              <td>
                <strong>プロパティ名</strong>
              </td>
              <td>
                <code>cactus.enableLogging</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>説明</strong>
              </td>
              <td>
		"true" に設定した場合、
		Cactus の内部ロギングが可能になります。
		ロギングを有効にするにはクラスパスに		
		<code>log4j.jar</code>
		も加える必要があることに注意してください。
		指定されなかったり、値が "true" 以外の値であった場合、
		ロギングは無効になります。
              </td>
            </tr>
            <tr>
              <td>
                <strong>例</strong>
              </td>
              <td>
                <code>cactus.enableLogging = true</code>
              </td>
            </tr>
          </table>

          <p>
            Sample <code>cactus.properties</code> file :
          </p>
          <p>
            <code>cactus.properties</code> サンプルファイル :
          </p>

<source><![CDATA[
# Configuration file for Cactus.
# Cactus の設定ファイル

# Each project using Cactus need to have such a file put in the client side
# CLASSPATH (Meaning the directory containgin this file should be in the client
# side CLASSPATH, not the file itself of course ... :) )
# Cactus を使用している個々のプロジェクトはクライアント側のクラスパスに
# このようなファイルを置かなければならなりません。(これは、このファイルがある
# ディレクトリはクライアント側のクラスパスであるという意味で、
# ファイル自身をクラスパスに入れるという意味ではありません)

# Defines the URLs that will be used by Cactus to call it's redirectors.
# You need to specify in these URLs the webapp context that you use for your
# application. In the example below, the context is "test".
# リダイレクタが呼び出せるよう Cactus で使われる URL を定義します。
# これらの URL において、アプリケーションうウェブアプリケーション
# コンテキストを指定しなければなりません。

# Web app Context under which our application to test runs
# テストすべきアプリケーションが実行されるウェブアプリケーションコンテキスト
cactus.contextURL = http://localhost:@test.port@/test

# Default Servlet Redirector Name. Used by ServletTestCase test cases.
# デフォルトのサーブレットリダイレクタ名
# ServletTestCase テストケースで使われます
cactus.servletRedirectorName = ServletRedirector

# Default JSP Redirector Name. Used by JspTestCase test cases.
# デフォルトの JSP リダイレクタ名。JspTestCase テストケースで使われます
cactus.jspRedirectorName = JspRedirector

# Default Filter Redirector Name. Used by FilterTestCase test cases.
# デフォルトのフィルターリダイレクタ名。
# FilterTestCase テストケースで使われます
cactus.filterRedirectorName = FilterRedirector

# Enable Cactus internal logging
# Cactus の内部ロギングを有効にします。
#cactus.enableLogging = true
]]></source>

          <anchor id="client_location_cactus_properties"/>
          <p>
            There are 2 ways to tell Cactus where <code>cactus.properties</code>
            is located.
          </p>
          <p>
	    Cactus に <code>cactus.properties</code>
	    の位置を指定する方法は 2 つあります。
          </p>
          <ul>
            <li>
              The preferred mechanism is to put it in the client side
              classpath (i.e. have a CLASSPATH entry that points to the
              directory where it is located).
            </li>
            <li>
	      推奨する方法は、これをクライアント側のクラスパスに置くことです。
	      (即ち、これが置かれたディレクトリを指す項目を CLASSPATH に持たせる事です)
            </li>
            <li>
              The other option is to pass a command line parameter when
              starting your JVM. See the
              <jump anchor="client_command_line">Command line section</jump>
              below.
            </li>
            <li>
	      もう一つの方法は、JVM 起動時にコマンドラインパラメータを送るというものです。
              下の <jump anchor="client_command_line">コマンドラインの節</jump>
              をご覧ください。
            </li>
          </ul>

        </s3>

        <anchor id="client_log_client_properties"/>
        <s3 title="log_client.properties">

          <p>
            A default <code>log_client.properties</code> is already provided
            in the <code>cactus.jar</code> jar. It is used for
            configuring Log4j, which is the logging framework used by Cactus
            to log debug information.
          </p>
          <p>
	    デフォルトの <code>log_client.properties</code> は、
	    既に <code>cactus.jar</code> jar ファイルの中で提供されています。
	    これは、
	    Cactus がデバッグ情報をログ出力するのに使われるロギングフレームワークである 
	    Log4j を設定するのに使われます。
          </p>

          <p>
            If the Log4j jar is not present on the client side classpath,
            Cactus will not log anything. In addition you need to
            explicitely tell Cactus to perform logging (if that's what you
            want). This can be achieved in 2 ways :
          </p>
          <p>
	    Log4j の jar ファイルがクライアント側のクラスパスに無い場合、
	    Cactus は何もログ出力しません。
	    加えて、(それが必要ならば) Cactus がロギングを行うよう明白に指示する必要があります。これを行うには 2 つの方法があります : 
          </p>
          <ul>
            <li>
              By having a <code>cactus.enableLogging = true</code> property
              in your <code>cactus.properties</code> file (as described
              above),
            </li>
            <li>
	      (先に述べたように)
	      <code>cactus.properties</code> ファイルにおいて、
	      <code>cactus.enableLogging = true</code> プロパティを持たせることにより
            </li>
            <li>
              By passing a property on the Java command line when starting
              the JVM. See the
              <jump anchor="client_command_line">Command line section</jump>.
            </li>
            <li>
	      JVM を起動する時に、コマンドラインのプロパティとして渡すことにより。
              <jump anchor="client_command_line">Command コマンドラインの節</jump> を見てください。
            </li>
          </ul>
          <p>
            The default <code>log_client.properties</code> is :
          </p>
          <p>
            デフォルトの <code>log_client.properties</code> は次の通りです :
          </p>

<source><![CDATA[
# Properties for configuring Log4j
# Log4j を設定するためのプロパティ
# This is the configuring for logging on the JUnit side (i.e. the client side)
# これは JUnit 側(即ちクライアント側)のロギング設定です。

log4j.appender.cactus = org.apache.log4j.FileAppender
log4j.appender.cactus.File = cactus_client.log
log4j.appender.cactus.Append = false
log4j.appender.cactus.layout = org.apache.log4j.PatternLayout
log4j.appender.cactus.layout.ConversionPattern = %d{ABSOLUTE} [%t] %-5p %-30.30c{2} %x - %m %n

# Any application log which uses Log4J will be logged to the Cactus log file
# Log4j を使ったどんなアプリケーションログでも Cactus ログファイルに
# 出力されます
log4j.rootCategory=DEBUG, cactus

# By default we don't log at the DEBUG level for Cactus log, in order not to generate too
# many logs. However, should a problem arise and logs need to be sent to the Cactus dev team,
# then we will ask you to change this to DEBUG.
# デフォルトでは、ログを大量に出力しすぎないように、
# Cactus ログをデバッグレベルで出力しません。
# しかしながら、問題の発生とログは Cactus 開発チームに送られなければ
# なりません。
log4j.category.org.apache.cactus = WARN, cactus
log4j.additivity.org.apache.cactus=false
]]></source>

          <p>
            If you want to understand how to configure Log4j, go to the
            <link href="http://jakarta.apache.org/log4j">Log4j web site</link>.
          </p>
          <p>
	    Log4j の設定法を理解したい場合には、
            <link href="http://jakarta.apache.org/log4j">Log4j ウェブサイト</link>を参照してください。
          </p>

          <p>
            If you wish to define another file name and location or other
            logging parameter, just provide your own
            <code>log_client.properties</code> file (it has to be named this
            way) and put in the client side classpath <strong>before</strong>
            the <code>cactus.jar</code> file.
          </p>
          <p>
	    別のファイル名や保存場所やログパラメーターを定義したい場合には、
	    自分の <code>log_client.properties</code> ファイル	
	    (<suspect>このような方法で名前を付けられるべきです</suspect>)
	    を提供し、
	    クライアント側クラスパス中の
            <code>cactus.jar</code>ファイル<strong>よりも前の</strong>場所に置くだけです。
          </p>

        </s3>

        <anchor id="client_command_line"/>
        <s3 title="コマンドラインパラメータ/Command line parameters">

          <note>
            Command line parameters are purely optional and should only be used
            for very specific cases where the preferred method cannot be used
            (the preffered method is through <code>cactus.properties</code>).
          </note>
          <note>
	    コマンドラインパラメータは純粋にオプションであり、
	    推奨される方法が使えない場合といった、
	    とても特別な場合にのみ使われるべきです。
	    (推奨される方法とは<code>cactus.properties</code>によるものです)
          </note>

          <p>
            The following command line properties can be passed on the java
            command line :
          </p>
          <p>
	    次のコマンドラインプロパティが java のコマンドラインに渡されます : 
          </p>

          <table>
            <tr>
              <td>
                <strong>Property Name</strong>
              </td>
              <td>
                <code>cactus.enableLogging</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>Description</strong>
              </td>
              <td>
                If set to "true" Cactus internal logging is enabled. Note that
                you will also need <code>log4j.jar</code> in your classpath to
                activate logging. If not specified or set to a value different
                than "true", Cactus logging is disabled.
              </td>
            </tr>
            <tr>
              <td>
                <strong>Example</strong>
              </td>
              <td>
                <code>-Dcactus.enableLogging=true</code>
              </td>
            </tr>
          </table>

          <table>
            <tr>
              <td>
                <strong>プロパティ名</strong>
              </td>
              <td>
                <code>cactus.enableLogging</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>説明</strong>
              </td>
              <td>
		"true" に設定した場合、
		Cactus の内部ロギングが可能になります。
		ロギングを有効にするにはクラスパスに		
		<code>log4j.jar</code>
		も加える必要があることに注意してください。
		指定されなかったり、値が "true" 以外の値であった場合、
		ロギングは無効になります。
              </td>
            </tr>
            <tr>
              <td>
                <strong>例</strong>
              </td>
              <td>
                <code>-Dcactus.enableLogging=true</code>
              </td>
            </tr>
          </table>

          <p>
            <br/>
          </p>

          <table>
            <tr>
              <td>
                <strong>Property Name</strong>
              </td>
              <td>
                <code>cactus.config</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>Description</strong>
              </td>
              <td>
                Specify where to find the Cactus configuration file.
                By default Cactus looks for a <code>cactus.properties</code>
                file in the classpath. This property overrides this behaviour.
              </td>
            </tr>
            <tr>
              <td>
                <strong>Example</strong>
              </td>
              <td>
                <code>-Dcactus.config=conf/mycactus.properties</code>
              </td>
            </tr>
          </table>

          <table>
            <tr>
              <td>
                <strong>プロパティ名</strong>
              </td>
              <td>
                <code>cactus.config</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>説明</strong>
              </td>
              <td>
	        Cactus 設定ファイルの検索場所を指定します。
	        デフォルトでは、Cactus は、クラスパス中の
	        <code>cactus.properties</code> ファイルを探します。
	        本プロパティは、この振舞いを上書きします。
              </td>
            </tr>
            <tr>
              <td>
                <strong>例</strong>
              </td>
              <td>
                <code>-Dcactus.config=conf/mycactus.properties</code>
              </td>
            </tr>
          </table>

        </s3>

      </s2>

      <anchor id="serverside"/>
      <s2 title="サーバ側設定ファイル/Server side configuration files">

        <s3 title="cactus.properties">

          <p>
            First and foremost, this file is completely optional on the server
            side (whereas it is mandatory on the client side). It is only
            used to turn on Cactus internal logging on the server side.
          </p>
          <p>
	    まず最初に最も重要な事は、
	    このファイルは
    	    (クライアント側では義務であるにもかかわらず)
	    サーバ側では完全にオプションであるということです。
	    これは、サーバ側の Cactus の内部ロギングを有効にするのにのみ使われます。
          </p>
          <note>
            Please note that Cactus logging on the server side can also be
            turned on by using a java command line property (see the
            <jump anchor="server_command_line">command line</jump> section
            below).
          </note>
          <note>
	    サーバ側の Cactus のロギングは、
	    java のコマンドラインプロパティを使っても有効にできることに注意してください。
	    (下の<jump anchor="server_command_line">コマンドライン</jump>の節を見てください。)
          </note>

          <p>
            Here are the properties that you can set in
            <code>cactus.properties</code> :
          </p>
          <p>
	    <code>cactus.properties</code> で設定できるプロパティは次の通りです : 
          </p>

          <table>
            <tr>
              <td>
                <strong>Property Name</strong>
              </td>
              <td>
                <code>cactus.enableLogging</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>Description</strong>
              </td>
              <td>
                If set to "true" Cactus internal logging is enabled. Note that
                you will also need <code>log4j.jar</code> in your classpath to
                activate logging. If not specified or set to a value different
                than "true", Cactus logging is disabled.
              </td>
            </tr>
            <tr>
              <td>
                <strong>Example</strong>
              </td>
              <td>
                <code>cactus.enableLogging = true</code>
              </td>
            </tr>
          </table>

          <table>
            <tr>
              <td>
                <strong>プロパティ名</strong>
              </td>
              <td>
                <code>cactus.enableLogging</code>
              </td>
            </tr>
            <tr>
              <td>
                <strong>説明</strong>
              </td>
              <td>
		"true" に設定した場合、
		Cactus の内部ロギングが可能になります。
		ロギングを有効にするにはクラスパスに		
		<code>log4j.jar</code>
		も加える必要があることに注意してください。
		指定されなかったり、値が "true" 以外の値であった場合、
		ロギングは無効になります。
              </td>
            </tr>
            <tr>
              <td>
                <strong>例</strong>
              </td>
              <td>
                <code>cactus.enableLogging = true</code>
              </td>
            </tr>
          </table>

          <p>
            Location of <code>cactus.properties</code> works in the same
            way as on the
            <jump anchor="client_location_cactus_properties">client side</jump>.
          </p>
          <p>
	    <code>cactus.properties</code> の位置は、
	    <jump anchor="client_location_cactus_properties">クライアント側</jump>と同じ方法で動作します。
          </p>

        </s3>

        <s3 title="web.xml">

          <p>
            Your server side tests are packaged as a web application (either
            expanded or as .war file) and thus you need to have a
            <code>web.xml</code> file to configure your test web application.
          </p>
          <p>
	    自分のサーバ側テストがウェブアプリケーションとして
	    (展開されたもの、あるいは .war ファイルとして)パッケージ化たら、
	    自分のテストウェブアプリケーションを設定するために
	    <code>web.xml</code> ファイルを置かなければなりません。
          </p>
          <note>
            If your servlet engine does not support web applications, it
            won't support a <code>web.xml</code> file. You'll need to edit
            your servlet engine proprietary configuration file and find out
            out to map a Servlet, JSP or Filter to a URL.
          </note>
          <note>
	    使っているサーブレットエンジンがウェブアプリケーションをサポートしていない場合、
	    <code>web.xml</code> ファイルをサポートしていないでしょう。
	    使っているサーブレットエンジンのプロパティ設定ファイルを編集したり、
	    サーブレット、JSP、フィルターから URL へのマッピングを見つけなければなりません。
          </note>
          <p>
            You need to register the Cactus Redirectors that you use (see
            <link href="how_it_works.html">How it works</link> if you don't
            know what a Cactus Redirector is).
          </p>
          <p>
	    使っている Cactus リダイレクタを登録する必要があります。
	    (Cactus リダイレクタとは何か知らない場合には、
	    <link href="how_it_works.html">Cactus の仕組み</link>を見てください)
          </p>
          <p>
            For example, in order to match the sample
            <code>cactus.properties</code> file defined above, we'll need to
            name our web application "<code>test</code>" and  write our
            <code>web.xml</code> in the following way :
          </p>
          <p>
	    例として、上で定義した
	    <code>cactus.properties</code> ファイルにマッチするように、
	    自分のウェブアプリケーションを "<code>test</code>" と名づけ、
	    <code>web.xml</code> ファイルを次のような方法で記述する必要があります : 
          </p>

<source><![CDATA[
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>

    <filter>
        <filter-name>FilterRedirector</filter-name>
        <filter-class>org.apache.cactus.server.FilterTestRedirector</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>FilterRedirector</filter-name>
        <url-pattern>/FilterRedirector</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>ServletRedirector</servlet-name>
        <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>JspRedirector</servlet-name>
        <jsp-file>/jspRedirector.jsp</jsp-file>
    </servlet>

    <servlet-mapping>
        <servlet-name>ServletRedirector</servlet-name>
        <url-pattern>/ServletRedirector</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>JspRedirector</servlet-name>
        <url-pattern>/JspRedirector</url-pattern>
    </servlet-mapping>

</web-app>
]]></source>

          <note>
            If you are using the JSP Redirector (i.e. you have test classes
            that extend <code>JspTestCase</code>), you <strong>must</strong>
            copy the <code>jspRedirector.jsp</code> file (found in the
            <code>sample/web</code> directory where you unpacked your
            Cactus distribution) in a directory in your webapp and you need to
            put it's relative path in the mapping defined above (here we
            have put it in the webapp root.
          </note>
          <note>
	    JSP リダイレクタ(即ち <code>JspTestCase</code>を拡張したテストクラス)がある場合、
            (Cactus ディストリビューションを解凍した
	    <code>sample/web</code>ディレクトリにある)
	    <code>jspRedirector.jsp</code>ファイルを webapp の下にあるディレクトリに置き、その相対パスを上で定義したマッピングに設定し<strong>なければなりません</strong>。
	    (ここでは、それを webapp のルートに置きました)
          </note>

          <p>
            If you want to provide some initialisation parameters that will
            be available to the <code>config</code> implicit object available
            in your test case, simply use the standard <code>
            &lt;init-param&gt;</code> tags.
          </p>
          <p>
	    自分のテストケースで使われる <code>config</code> 暗黙オブジェクトで利用可能な初期化パラメーターを幾つか提供したい場合には、
	    単に標準の<code>&lt;init-param&gt;</code>タグを使えばよいのです。
          </p>
          <p>
            For example, for the Servlet Redirector (same principle applies
            to all other redirectors) :
          </p>
          <p>
            例えば、サーブレットリダイレクタの場合次のようになります
	    (他のリダイレクタに対しても同じ原則があてはまります) : 
          </p>

<source><![CDATA[
[...]
    <servlet>
        <servlet-name>ServletRedirector</servlet-name>
        <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
        <init-param>
          <param-name>param1</param-name>
          <param-value>value1 used for testing</param-value>
        </init-param>
    </servlet>
[...]
]]></source>

          <note>
            Within your <code>testXXX()</code> code, you can also call the
            <code>config.setInitParameter()</code> method (<code>config</code>
            being the implicit object of type <code>ServletConfig</code>) to
            simulate initialisation parameters as if they had been defined in
            your <code>web.xml</code>.
          </note>
          <note>
	    <code>testXXX()</code> コード中で、
	    <code>web.xml</code>で定義されていたような初期化パラメータをシミュレートするために、
	    <code>config.setInitParameter()</code> メソッド(<code>ServletConfig</code>型の<code>config</code>暗黙オブジェクトである<code>config</code>)を呼び出せます。
          </note>

          <p>
            Lastly, if you need to unit test code that uses the Servlet
            Security API, please check the
            <link href="howto_security.html">Security Howto</link>.
          </p>
          <p>
	    最後に、Servlet Security API を使った単体テストコードが必要な場合には、<link href="howto_security.html">セキュリティHowto</link>を参照してください。
          </p>

        </s3>

        <s3 title="log_server.properties">

          <p>
            It works in the same way as for the
            <jump anchor="client_log_client_properties">client side</jump>.
          </p>
          <p>
	    <jump anchor="client_log_client_properties">クライアント側</jump>と同じ方法で動作します。
          </p>
          <p>
            The default <code>log_server.properties</code> is :
          </p>
          <p>
            デフォルト<code>log_server.properties</code>は次の通りです :
          </p>

<source><![CDATA[
# Properties for configuring Log4j
# Log4j 設定のためのプロパティ
# This is the configuring for logging on the server side
# これはサーバ側のロギング設定です。

log4j.appender.cactus = org.apache.log4j.FileAppender
log4j.appender.cactus.File = cactus_server.log
log4j.appender.cactus.Append = false
log4j.appender.cactus.layout = org.apache.log4j.PatternLayout
log4j.appender.cactus.layout.ConversionPattern = %d{ABSOLUTE} [%t] %-5p %-30.30c{2} %x - %m %n

# Any application log which uses Log4J will be logged to the Cactus log file
# Log4j を使ったどんなアプリケーションログでも Cactus ログファイルに
# 出力されます
log4j.rootCategory=DEBUG, cactus

# By default we don't log at the DEBUG level for Cactus log, in order not to generate too
# many logs. However, should a problem arise and logs need to be sent to the Cactus dev team,
# then we will ask you to change this to DEBUG.
# デフォルトでは、ログを大量に出力しすぎないように、
# Cactus ログをデバッグレベルで出力しません。
# しかしながら、問題の発生とログは Cactus 開発チームに送られなければ
# なりません。
log4j.category.org.apache.cactus = WARN, cactus
log4j.additivity.org.apache.cactus=false
]]></source>

          <p>
            If you wish to define another file name and location or other
            logging parameter, just provide your own
            <code>log_server.properties</code> file (it has to be named this
            way) and put in the <code>WEB-INF/classes</code> directory of
            your webapp (and hope that the webapp classloader of your server
            picks up the files in <code>WEB-INF/classes</code> before the ones
            in <code>WEB-INF/lib</code>, where <code>cactus.jar</code>
            is located ... :) I don't know if this is part of the
            specification). Alternatively, edit the file in
            <code>cactus.jar</code> !
          </p>
          <p>
	    別のファイル名や保存場所やログパラメーターを定義したい場合には、

	    自分の <code>log_server.properties</code> ファイル	
	    (このような方法で名前を付けられるべきです)
	    を提供し、
	    自分の webapp の
	    <code>WEB-INF/classes</code> ディレクトリに置くだけです。

	    (サーバーの webapp クラスローダーが、
	    <code>cactus.jar</code> のある
	    <code>WEB-INF/lib</code> のファイルよりも前に、
	    <code>WEB-INF/classes</code> からファイルを取り出すことを期待します ... :) これが仕様の一部なのかはわかりません)
	    別な方法としては、<code>cactus.jar</code> の中のファイルを編集します。
          </p>

        </s3>

        <anchor id="server_command_line"/>
        <s3 title="コマンドラインパラメータ/Command line parameters">

          <p>
            Command line parameters on the server side are exactly the same
            as on the client side. in order to use them you'll have to modify
            the startup script of your container and add your properties to it.
          </p>
          <p>
	    サーバ側のコマンドラインパラメータはクライアント側と全く同じです。
	    それを使うには、
	    使っているコンテナの起動スクリプトを変更し、
	    それにプロパティを加える必要があります。
          </p>
          <p>
            Again, please bear in mind that this is completely optional and
            that the preferred method is by using
            <code>cactus.properties</code>.
          </p>
          <p>
	    繰り返しになりますが、これは完全にオプションであり、
	    推奨される方法は<code>cactus.properties</code>を使ったものであるということを心に留めておいてください。
          </p>

        </s3>

      </s2>

    </s1>

  </body>
</document>
