|
Strutsフレームワーク
|
| Installing Struts with your servlet container |
|
| Struts をサーブレットコンテナにインストールする |
In the steps below, $ORION_HOME refers to the directory in which
you have installed Orion, and $STRUTS_HOME is the directory in
which you unpacked the Struts binary distribution.
以下のステップにおいて、 $ORION_HOME は Orion
をインストールしたディレクトリへの参照であり、また $STRUTS_HOME
は Struts バイナリ配布版を解凍したディレクトリです。
- Modify the file
$ORION_HOME/config/application.xml to define
the two new applications, by adding the following declarations, immediately
following the web-module directive for the default web application:
$ORION_HOME/config/application.xml ファイルを変更して、
既存の Web アプリケーションに関する web-module ディレクティブの直後に次の宣言を追加し、
2つのアプリケーションを新しく定義します:
<web-module id="strutsDoc"
path="$STRUTS_HOME/webapps/struts-documentation.war"/>
<web-module id="strutsExample"
path="$STRUTS_HOME/webapps/struts-example.war"/>
- Modify the file
$ORION_HOME/config/default-web-site.xml (or
the configuration file for any other Orion web site) to include the following
declarations, after the declaration for the <default-web-app> if any:
$ORION_HOME/config/default-web-site.xml ファイル(または他の Orion Web サイトの設定ファイル)
を変更して、(もしあるのならば <default-web-app> 宣言の後に)
以下の宣言を組み込みます:
<web-app application="default" name="strutsDoc"
root="/struts-documentation"/>
<web-app application="default" name="strutsExample"
root="/struts-example"/>
- After you start Orion, you should now be able to access these applications
(assuming you haven't changed the port number from the default of 80) at:
- Orion を起動後、(ポート番号を既定の 80 から変更していなければ)
ここから、これらのアプリケーションに接続することができます:
http://localhost/struts-documentation
http://localhost/struts-example
- Versions of Orion up to at least 1.0.3 have a bug related to ServletContext.getResource()
calls that prevent the Struts example application from working out of the
box. This manifests itself as a JSP error when you try to access the example
application, with the following message:
javax.servlet.jsp.JspException: Missing resources attributeorg.apache.struts.action.MESSAGE
followed by an error traceback. There will also be an initialization error
message in the ORION_HOME/log/global-application.log log file.
To work around this problem, you can take the following steps:
- Go to the
$STRUTS_HOME/webapps directory, where you will
note that Orion has automatically expanded each web application into an
unpacked directory structure.
- Go to the
$STRUTS_HOME/webapps/struts-example/WEB-INF directory,
and copy the file struts-config.xml one directory up (that
is, into $STRUTS_HOME/webapps/struts-example.
- Modify the
$STRUTS_HOME/webapps/struts-example/WEB-INF/web.xm
file, changing the value of the "config" initialization parameter (for the
action servlet) from /WEB-INF/struts-config.xml to /action.xml.
- Restart Orion, and you should be able to access the example application.
- Note that this workaround has a negative security-related side effect:
your
struts-conifig.xml file can now be retrieved by remote
clients at the following URL:
http://localhost/struts-example/struts-config.xml
Therefore, you should be sure you do not store sensitive information (such
as database passwords) in this file.
- Orion の最も古いバージョンである 1.0.3 では ServletContext.getResource()
の呼び出しに関するバグがあり、Struts サンプルアプリケーションの動作の妨げになります。
このこと自体はサンプルアプリケーションに接続してみることで JSP エラー として再現でき、
次のメッセージを伴います:
javax.servlet.jsp.JspException: Missing resources attributeorg.apache.struts.action.MESSAGE
エラー追跡情報がその後に続きます。そのとき、さらに初期化エラーのメッセージを
ORION_HOME/log/global-application.log ログファイルに残します。
次のステップを踏むことで、この問題に対処することができます:
$STRUTS_HOME/webapps ディレクトリへ移動します。
するとそこに Orion が自動的に展開した各 Web アプリケーションのディレクトリ構造があることに気が付くと思います。
$STRUTS_HOME/webapps/struts-example/WEB-INF ディレクトリへ移動し、
struts-config.xml ファイルを、一つ上のディレクトリへ(つまり
$STRUTS_HOME/webapps/struts-example の中に)コピーします。
$STRUTS_HOME/webapps/struts-example/WEB-INF/web.xm [訳注: web.xml
の誤りと思われます]ファイルを修正して、( action servlet の) "config" 初期化パラメータを
/WEB-INF/struts-config.xml から /action.xmlへ変更します。
- Orion を再起動すると、サンプルアプリケーションに接続することができます。
- この措置にはセキュリティに関する悪影響があるため注意してください:
次の URL から
struts-conifig.xml
ファイルをリモートクライアントによって取得できるようになります:
http://localhost/struts-example/struts-config.xml
それ故、当然このファイル内には(データベースパスワードのような)
秘匿情報を保存しておくべきではありません。
Back to Installation
インストールへ戻る
|
|