ページ・リスト・サーブレット・クライアント構成の構成
PageListServlet 構成情報は、IBM® Web 拡張ファイルに定義することができます。 IBM Web 拡張ファイルは、アセンブリー・ツールによって作成されて、Web アプリケーション・アーカイブ (WAR) ファイルに保管されます。
このタスクについて
重要: PageList サーブレット・カスタム拡張機能は WebSphere® Application Server バージョン 9.0 では推奨されません。この機能は、将来のリリースでは除去される予定です。com.ibm.servlet クラスを使用するのではなく、
レガシー・アプリケーションを再構築して javax.servlet.filter
クラスを使用してください。
Servlet 2.3 仕様以降では、javax.servlet.filter クラスで要求のインターセプトと応答の検査が可能です。
また、javax.servlet.filter クラスを使用して、機能のチェーニングと応答の修飾または切り捨てができます。
ページ・リストは以下の手順で構成し、実装します。
手順
PageListServlet の拡張
以下の例では、サーブレットが PageListServlet クラスを拡張し、 クライアントが必要とするマークアップ言語のタイプを判別する方法を示します。 サーブレットは、次に callPage メソッドを使用して、該当する JavaServer Pages (JSP) ファイルを呼び出します。 この例では、応答に対する適切なマークアップ言語を提供する JSP ファイルは、Hello.page です。
public class HelloPervasiveServlet extends PageListServlet implements Serializable
{
/*
* doGet -- Process incoming HTTP GET requests
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
// This is the name of the page to be called:
String pageName = "Hello.page";
// First check if the servlet was invoked with a queryString that contains
// a markup-language value.
// For example, if this is how the servlet is invoked:
// http://localhost/servlets/HeloPervasive?mlname=VXML
// then use the following method:
String mlname= getMLNameFromRequest(request);
// If no markup language type is provided in the queryString,
// then try to determine the client
// Type from the request, and use the markup-language name configured in
// the client_types.xml file. if (mlName == null)
{
mlName = getMLTypeFromRequest(request);
}
try
{
// Serve the request page.
callPage(mlName, pageName, request, response);
}
catch (Exception e)
{
handleError(mlName, request, response, e);
}
}
}