The client_types.xml file

The client_types.xml file provides client type detection support for servlets extending PageListServlet. Using the configuration data in the client_types.xml file, servlets can determine the language type that calling clients require for the response.

Attention: The PageList Servlet custom extension is deprecated in WebSphere® Application Server Version 8.5 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.

The client type detection support allows servlets to call appropriate JavaServer Pages (JSP) files with the callPage method. Servlets select JSP files based on the markup-language type of the request.

Servlets must use the following version of the callPage method to determine the markup language type required by the client:

callPage(String mlName, String pageName, HttpServletRequest request, 
                  HttpServletResponse response)

where the arguments are:

  • mlName - a markup language type
  • pageName - a page name defined in the PageListServlet configuration
  • request - the HttpServletRequest object
  • response - the HttpServletResponse object

Review the Extending the PageListServlet code example in the Extending the PageListServlet topic, to see how the callPage method is invoked by a servlet.

In the example, the client type detection method, getMLTypeFromRequest(HttpServletRequestrequest), provided by the PageListServlet, inspects the HttpServletRequest object request headers, and searches for a match in the client_types.xml file.

The client type detection method does the following:

  • Uses the input HttpServletRequest and the client_types.xml file, to check for a matching HTTP request name and value.
  • Returns the markup-language value configured for the <client-type> element, if a match is found.
  • If multiple matches are found, this method returns the markup-language for the first <client-type> element for which a match is found.
  • If no match is found, returns the value of the markup-language for the default page defined in the PageListServlet configuration.

Location

The client_types.xml file is located in the install_root/properties directory.

Usage notes

Review the answers to the following usage questions:

  • Is this file read-only?

    No

  • Is this file updated by a product component?

    No

  • If so, what triggers its update?

    This file is created and updated manually by users.

  • How and when are the contents of this file used?

    Servlets that extending the PageListServlet servlet use this file to determine the language type that calling clients require for the response.

Sample file entry


<?xml version="1.0" >
<!DOCTYPE clients [
<!ELEMENT client-type (description, markup-language,request-header+)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT markup-language (#PCDATA)>
<!ELEMENT request-header (name, value)>
<!ELEMENT clients (client-type+)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT value (#PCDATA)>]>
<clients>
      <client-type>
      <description>IBM Speech Client</description>
      <markup-language>VXML</markup-language>
      <request-header>
           <name>user-agent</name>
           <value>IBM VoiceXML pre-release version 000303</value>
      </request-header>
      <request-header>
           <name>accept</name>
           <value>text/vxml</value>
      </request-header>
      </client-type>
      <client-type>
           <description>WML Browser</description>
           <markup-language>WML</markup-language>
      <request-header>
           <name>accept</name>
           <value>text/x-wap.wml</value>
      </request-header>
      <request-header>
           <name>accept</name>
           <value>text/vnd.wap.xml</value>
      </request-header>
    </client-type>
</clients>