PageListServlet 構成情報は、IBM Web 拡張ファイルに 定義することができます。 IBM Web 拡張ファイルは、アセンブリー・ツールによって作成されて、 Web アプリケーション・アーカイブ (WAR) ファイルに保管されます。
ページ・リストは以下の手順で構成し、インプリメントします。
以下の例では、サーブレットが 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); } } }