Configuring page list servlet client configurations
You can define PageListServlet configuration information in the IBM® Web Extensions file. The IBM Web Extensions file is created and stored in the web applications archive (WAR) file by an assembly tool.
About this task
Attention: The PageList Servlet custom extension
is deprecated in WebSphere® Application Server Versão 9.0 and will be removed
in a future release. Re-architect your legacy applications to use
javax.servlet.filter classes instead of com.ibm.servlet classes. Starting
from the Servlet 2.3 specification, javax.servlet.filter classes you
can intercept requests and examine responses. You can also use javax.servlet.filter
classes to achieve chaining functionality, as well as embellishing
or truncating responses.
To configure and implement page lists:
Procedure
Extending PageListServlet
The following example shows how a servlet extends the PageListServlet class and determines the markup-language type required by the client. The servlet then uses the callPage method to call an appropriate JavaServer Pages (JSP) file. In this example, the JSP file that provides the correct markup-language for the response is 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);
}
}
}