ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzamy_5.4.0.1/50/program/servpxml.htm

94 lines
4.1 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>client_types.xml</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h5><a name="servpxml"></a>client_types.xml</h5>
<p>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.</p>
<p>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.</p>
<p>Servlets must use the following version of the callPage() method to determine the markup language type required by the client:</p>
<pre> callPage(String <em>mlName</em>,
String <em>pageName</em>,
HttpServletRequest <em>request</em>,
HttpServletResponse <em>response</em>)</pre>
<p>where the arguments are:</p>
<ul>
<li><em>mlName</em> is a markup language type</li>
<li><em>pageName</em> is a page name that is defined in the PageListServlet configuration</li>
<li><em>request</em> is the HttpServletRequest object</li>
<li><em>response</em> is the HttpServletResponse object</li>
</ul>
<p>To see how the callPage() method is invoked by a servlet, see <a href="servpex.htm">Example: Extending PageListServlet</a>.</p>
<p>In the example, the client type detection method that is provided by the PageListServlet, getMLTypeFromRequest(HttpServletRequestrequest), inspects the HttpServletRequest object request headers and searches for a match in the client_types.xml file.</p>
<p>The client type detection method performs these functions:</p>
<ul>
<li>Uses the input HttpServletRequest and the client_types.xml file to check for a matching HTTP request name and value.</li>
<li>Returns the markup-language value configured for the &lt;client-type&gt; element, if a match is found.</li>
<li>If multiple matches are found, this method returns the markup language for the first &lt;client-type&gt; element for which a match is found.</li>
<li>If no match is found, returns the value of the markup language for the default page defined in the PageListServlet configuration.</li>
</ul>
<p>The client_types.xml file is located in the /QIBM/UserData/WebASE/ASE5/<em>instance</em>/properties directory, where <em>instance</em> is the name of your instance.</p>
<p><strong>Sample file entry</strong></p>
<pre> &lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE clients [
&lt;!ELEMENT client-type (description,markup-language,request-header+)&gt;
&lt;!ELEMENT description (#PCDATA)&gt;
&lt;!ELEMENT markup-language (#PCDATA)&gt;
&lt;!ELEMENT request-header (name,value)&gt;
&lt;!ELEMENT clients (client-type+)&gt;
&lt;!ELEMENT name (#PCDATA)&gt;
&lt;!ELEMENT value (#PCDATA)&gt;]&gt;
&lt;clients&gt;
&lt;client-type&gt;
&lt;description&gt;IBM Speech Client&lt;/description&gt;
&lt;markup-language&gt;VXML&lt;/markup-language&gt;
&lt;request-header&gt;
&lt;name&gt;user-agent&lt;/name&gt;
&lt;value&gt;IBM VoiceXML pre-release version 000303&lt;/value&gt;
&lt;/request-header&gt;
&lt;request-header&gt;
&lt;name&gt;accept&lt;/name&gt;
&lt;value&gt;text/vxml&lt;/value&gt;
&lt;/request-header&gt;
&lt;/client-type&gt;
&lt;client-type&gt;
&lt;description&gt;WML Browser&lt;/description&gt;
&lt;markup-language&gt;WML&lt;/markup-language&gt;
&lt;request-header&gt;
&lt;name&gt;accept&lt;/name&gt;
&lt;value&gt;text/x-wap.wml&lt;/value&gt;
&lt;/request-header&gt;
&lt;request-header&gt;
&lt;name&gt;accept&lt;/name&gt;
&lt;value&gt;text/vnd.wap.wml&lt;/value&gt;
&lt;/request-header&gt;
&lt;/client-type&gt;
&lt;/clients&gt;</pre>
</body>
</html>