InfoCenter Home > 4.2.1.3.9.1: Extending PageListServletThe HelloPervasiveServlet is an example of a servlet that extends the PageListServlet class and attempts to determine the markup-language type required by the client. The servlet then uses the callPage() method to call the JSP with the page name of "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 contained a markup-language value. For example, if this // servlet was invoked like this: // http://localhost/servlets/HelloPervasive?mlname=VXML String mlName = getMLNameFromRequest(request); // If no ML type was provided in the queryString, then attempt to // determine the client type from the Request and use the ML name as // 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); } } }
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|