リモート側にリソースを組み込むためのフレームワーク・プログラミング・モデルでは、 非 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); }