페이지 목록 서블릿 클라이언트 구성
PageListServlet 구성 정보를 IBM® 웹 확장 파일에서 정의할 수 있습니다. IBM 웹 확장 파일은 어셈블리 도구에 의해 웹 애플리케이션 아카이브(WAR) 파일에서 작성 및 저장됩니다.
이 태스크 정보
주의: PageList Servlet 사용자 정의 확장은 WebSphere® Application
Server 버전 9.0에서 더 이상 사용되지 않으며 이후 릴리스에서
제거됩니다. com.ibm.servlet 클래스 대신에 javax.servlet.filter
클래스를 사용하도록 레거시 애플리케이션을 재구성하십시오. Servlet 2.3
스펙부터 javax.servlet.filter 클래스는
요청을 인터셉트하고 응답을 검사할 수 있습니다. javax.servlet.filter 클래스를 사용하여
응답 꾸미기 또는 자르기는 물론 연쇄 호출 기능을 달성할 수도 있습니다.
페이지 목록을 구성 및 구현하려면 다음을 수행하십시오.
프로시저
PageListServlet 확장
다음 예제는 Servlet이 PageListServlet 클래스를 확장하고 클라이언트가 필요로 하는 마크업 언어 유형을 판별하는 방법을 보여줍니다. 그리고 서블릿은 callPage 메소드를 사용하여 적절한 JSP(JavaServer Pages) 파일을 호출합니다. 이 예제에서, 응답에 올바른 마크업 언어를 제공하는 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);
}
}
}