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

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

例: フレームワーク・プログラミング・モデルを使用して 2 つの異なるコンテキストでリソースを探す

リモート側にリソースを組み込むためのフレームワーク・プログラミング・モデルでは、 非 Java 2 Platform, Enterprise Edition (J2EE) サーブレットのアプリケーション・プログラミング・インターフェース (API) を 使用する必要はありません。 現行の Web コンテナー内で 現在稼働していない ServletContext 名に対して要求が開始されると、 リモート要求ディスパッチャー (RRD) コンポーネントは ServletContext オブジェクトを 戻します。このオブジェクトにより、WebSphere Application Sever Network Deployment 環境の 任意の場所にリソースが存在し、RRD がその ServletContext オブジェクトに対して有効である場合には、 そのリソースを探し出すことができます。 以下のフレームワーク・スニペット例は、 2 つの異なるコンテキスト (investments と banking) に存在するリソースを探す方法の実例です。参考にしてください。

/*
Programming example using a generic framework.
Servlet Specification provides an API to obtain
a servlet context in the scope of the same request
different from the current Web module context by
specifying a context parameter.
Servlet Specification restriction: The Web module that obtain
must run inside of the same JVM as the calling resource.
RRD extends this functionality by permitting the Web module to be located
within the scope of the current WebSphere Application Server core group
versus the scope of the JVM.
*/

protected void frameworkCall (ServletContext context, HttpServletRequest request, HttpServletResponse response) 
							throws ServletException, IOException(

			PrintWriter writer = response.getWriter();

			writer.write("<HTML>");
			writer.write("<HEAD>");
			writer.write("</HEAD>");
			writer.write("<BODY>");
			writer.write("<hr size=¥"5/">);

			//Include resource investmentSummary.jsp located in Web application
			//with context root of /investments.
			RequestDispatcher rd = getRequestDispatcher ( context, "/investments", "/investmentSummary.jsp");
			rd.include(request, response);

			writer.write("<hr size=¥"5/">);

			//Include resource accountSummary.jsp located in Web application
			//with context root of /banking.
			rd = getRequestDispatcher ( context, "/banking", "/accountSummary.jsp");
			rd.include(request, response);

			writer.write("</BODY>");
			writer.write("</HTML>");
}
private RequestDispatcher getRequestDispatcher (ServletContext context, String contextName, String resource) {
			return context.getContext(contexName).getRequestDispatcher(resource);
}



関連タスク
タスク概要: リモート要求ディスパッチャーを使用するアプリケーションのアセンブル
リモート組み込みをディスパッチするための Web アプリケーションの構成
リモート組み込みを処理するための Web アプリケーションの構成
関連資料
例: サーブレット・プログラミング・モデルを使用して 2 つの異なるコンテキストでリソースを探す
参照トピック    

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

最終更新: Jan 21, 2008 9:12:22 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/rweb_rrd_xml_framework.html