commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml XMLPreprocessor.html ValidationReflectionHandler.html ValidationHandler.html SuiteHandler.html SessionHandler.html RequestHeaderHandler.html RequestHandler.html ParameterHandler.html LatkaVariableEntityResolver.html LatkaHandler.html FindVariablesHandler.html
Date Mon, 01 Apr 2002 05:46:03 GMT
dion        02/03/31 21:46:03

  Added:       docs/latka/xref/java/org/apache/commons/latka/xml
                        XMLPreprocessor.html
                        ValidationReflectionHandler.html
                        ValidationHandler.html SuiteHandler.html
                        SessionHandler.html RequestHeaderHandler.html
                        RequestHandler.html ParameterHandler.html
                        LatkaVariableEntityResolver.html LatkaHandler.html
                        FindVariablesHandler.html
  Log:
  New Maven generated site
  
  Revision  Changes    Path
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/XMLPreprocessor.html
  
  Index: XMLPreprocessor.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/XMLPreprocessor.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>   
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> java.io.BufferedReader;
  <a name="63" href="#63">63</a>  <b>import</b> java.io.InputStreamReader;
  <a name="64" href="#64">64</a>  <b>import</b> java.io.IOException;
  <a name="65" href="#65">65</a>  <b>import</b> java.io.Reader;
  <a name="66" href="#66">66</a>  <b>import</b> java.io.StringReader;
  <a name="67" href="#67">67</a>  <b>import</b> java.io.StringWriter;
  <a name="68" href="#68">68</a>  
  <a name="69" href="#69">69</a>  <b>import</b> java.net.URL;
  <a name="70" href="#70">70</a>  
  <a name="71" href="#71">71</a>  <b>import</b> java.util.Properties;
  <a name="72" href="#72">72</a>  <b>import</b> java.util.Set;
  <a name="73" href="#73">73</a>  <b>import</b> java.util.TreeSet;
  <a name="74" href="#74">74</a>  
  <a name="75" href="#75">75</a>  <b>import</b> javax.xml.parsers.ParserConfigurationException;
  <a name="76" href="#76">76</a>  <b>import</b> javax.xml.parsers.SAXParser;
  <a name="77" href="#77">77</a>  <b>import</b> javax.xml.parsers.SAXParserFactory;
  <a name="78" href="#78">78</a>  
  <a name="79" href="#79">79</a>  <b>import</b> javax.xml.transform.Transformer;
  <a name="80" href="#80">80</a>  <b>import</b> javax.xml.transform.TransformerException;
  <a name="81" href="#81">81</a>  <b>import</b> javax.xml.transform.TransformerFactory;
  <a name="82" href="#82">82</a>  <b>import</b> javax.xml.transform.stream.StreamResult; 
  <a name="83" href="#83">83</a>  <b>import</b> javax.xml.transform.stream.StreamSource; 
  <a name="84" href="#84">84</a>  
  <a name="85" href="#85">85</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/index.html">org.apache.commons.latka</a>.<a href="../../../../../org/apache/commons/latka/LatkaProperties.html">LatkaProperties</a>;
  <a name="86" href="#86">86</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/index.html">org.apache.commons.latka</a>.<a href="../../../../../org/apache/commons/latka/Suite.html">Suite</a>;
  <a name="87" href="#87">87</a>  
  <a name="88" href="#88">88</a>  <b>import</b> org.apache.log4j.Category;
  <a name="89" href="#89">89</a>  
  <a name="90" href="#90">90</a>  <b>import</b> org.apache.regexp.RE;
  <a name="91" href="#91">91</a>  <b>import</b> org.apache.regexp.RESyntaxException;
  <a name="92" href="#92">92</a>  
  <a name="93" href="#93">93</a>  <b>import</b> org.xml.sax.InputSource;
  <a name="94" href="#94">94</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="95" href="#95">95</a>  
  <a name="96" href="#96">96</a>  <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="97" href="#97">97</a>  <font color="#AA0000"><i> * Methods for massaging the Latka XML.  Includes methods</font></i>
  <a name="98" href="#98">98</a>  <font color="#AA0000"><i> * for finding and substituting variables in the XML</font></i>
  <a name="99" href="#99">99</a>  <font color="#AA0000"><i> * stream with Latka variables.</font></i>
  <a name="100" href="#100">100</a> <font color="#AA0000"><i> * </font></i>
  <a name="101" href="#101">101</a> <font color="#AA0000"><i> * @author Morgan Delagrange</font></i>
  <a name="102" href="#102">102</a> <font color="#AA0000"><i> * @author dIon Gillard</font></i>
  <a name="103" href="#103">103</a> <font color="#AA0000"><i> * @see org.apache.commons.latka.LatkaProperties</font></i>
  <a name="104" href="#104">104</a> <font color="#AA0000"><i> * @version $Id: XMLPreprocessor.html,v 1.1 2002/04/01 05:46:02 dion Exp $</font></i>
  <a name="105" href="#105">105</a> <font color="#AA0000"><i> */</font></i>
  <a name="106" href="#106">106</a> <b>public</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/XMLPreprocessor.html">XMLPreprocessor</a> {
  <a name="107" href="#107">107</a>     <font color="#329900"><i>// FIXME: format here should be all caps?</font></i>
  <a name="108" href="#108">108</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>* Regular expression for variable name */</font></i></font></i>
  <a name="109" href="#109">109</a>     <b>protected</b> <b>static</b> <b>final</b> String _variableExpr = <font color="#000099">"&#47;&#47;$&#47;&#47;{(.*?)&#47;&#47;}"</font>;
  <a name="110" href="#110">110</a> 
  <a name="111" href="#111">111</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>* log4j Category for output to be logged to */</font></i></font></i>
  <a name="112" href="#112">112</a>     <b>protected</b> <b>static</b> Category _log = 
  <a name="113" href="#113">113</a>         Category.getInstance(XMLPreprocessor.<b>class</b>);
  <a name="114" href="#114">114</a> 
  <a name="115" href="#115">115</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>* singleton used to preprocess */</font></i></font></i>
  <a name="116" href="#116">116</a>     <b>protected</b> <b>static</b> <a href="../../../../../org/apache/commons/latka/xml/XMLPreprocessor.html">XMLPreprocessor</a> _processor = <b>new</b> <a href="../../../../../org/apache/commons/latka/xml/XMLPreprocessor.html">XMLPreprocessor</a>();
  <a name="117" href="#117">117</a>   
  <a name="118" href="#118">118</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="119" href="#119">119</a> <font color="#AA0000"><i>     * Private constructor to stop auto generation of public one</font></i>
  <a name="120" href="#120">120</a> <font color="#AA0000"><i>     */</font></i>
  <a name="121" href="#121">121</a>     <b>private</b> <a href="../../../../../org/apache/commons/latka/xml/XMLPreprocessor.html">XMLPreprocessor</a>() {
  <a name="122" href="#122">122</a>     }
  <a name="123" href="#123">123</a> 
  <a name="124" href="#124">124</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="125" href="#125">125</a> <font color="#AA0000"><i>     * Get an instance of this singleton class</font></i>
  <a name="126" href="#126">126</a> <font color="#AA0000"><i>     * </font></i>
  <a name="127" href="#127">127</a> <font color="#AA0000"><i>     * @return an XML preprocessor object</font></i>
  <a name="128" href="#128">128</a> <font color="#AA0000"><i>     */</font></i>
  <a name="129" href="#129">129</a>     <b>public</b> <b>static</b> <a href="../../../../../org/apache/commons/latka/xml/XMLPreprocessor.html">XMLPreprocessor</a> instance() {
  <a name="130" href="#130">130</a>         <b>return</b> _processor;
  <a name="131" href="#131">131</a>     }
  <a name="132" href="#132">132</a> 
  <a name="133" href="#133">133</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="134" href="#134">134</a> <font color="#AA0000"><i>     * Processes a Suite, preparing it for the final XML </font></i>
  <a name="135" href="#135">135</a> <font color="#AA0000"><i>     * processing.  In essence, this consists of finding</font></i>
  <a name="136" href="#136">136</a> <font color="#AA0000"><i>     * variables in the base XML document, looking for corresponding Latka</font></i>
  <a name="137" href="#137">137</a> <font color="#AA0000"><i>     * properties, and performing the substitutions.</font></i>
  <a name="138" href="#138">138</a> <font color="#AA0000"><i>     * This will only preprocess the base XML document;</font></i>
  <a name="139" href="#139">139</a> <font color="#AA0000"><i>     * the entities will be processed during the SAX parse</font></i>
  <a name="140" href="#140">140</a> <font color="#AA0000"><i>     * itself.  After running this method, it is guaranteed</font></i>
  <a name="141" href="#141">141</a> <font color="#AA0000"><i>     * that the preprocessed document will be stored in</font></i>
  <a name="142" href="#142">142</a> <font color="#AA0000"><i>     * Suite.getReader().</font></i>
  <a name="143" href="#143">143</a> <font color="#AA0000"><i>     * </font></i>
  <a name="144" href="#144">144</a> <font color="#AA0000"><i>     * @param suite Latka suite to preprocess</font></i>
  <a name="145" href="#145">145</a> <font color="#AA0000"><i>     * @throws IOException thrown if the stream could not be read,</font></i>
  <a name="146" href="#146">146</a> <font color="#AA0000"><i>     *                   or if variables could not be substituted</font></i>
  <a name="147" href="#147">147</a> <font color="#AA0000"><i>     *</font></i>
  <a name="148" href="#148">148</a> <font color="#AA0000"><i>     * @see LatkaVariableEntityResolver#resolveEntity(String,String)</font></i>
  <a name="149" href="#149">149</a> <font color="#AA0000"><i>     * @see org.apache.commons.latka.Latka#runTests(Suite,LatkaEventInfo) </font></i>
  <a name="150" href="#150">150</a> <font color="#AA0000"><i>     *      Latka.runTests(Suite,LatkaEventInfo)</font></i>
  <a name="151" href="#151">151</a> <font color="#AA0000"><i>     */</font></i>
  <a name="152" href="#152">152</a>     <b>public</b> <b>void</b> preprocessXml(<a href="../../../../../org/apache/commons/latka/Suite.html">Suite</a> suite) throws IOException {
  <a name="153" href="#153">153</a> 
  <a name="154" href="#154">154</a>         <font color="#329900"><i>// process the base document</font></i>
  <a name="155" href="#155">155</a>         String processedString = <b>null</b>;
  <a name="156" href="#156">156</a>         <b>if</b> (suite.getReader() != <b>null</b>) {
  <a name="157" href="#157">157</a>             processedString = resolveVariables(
  <a name="158" href="#158">158</a>                 stringFromReader(suite.getReader()));
  <a name="159" href="#159">159</a>         } <b>else</b> {
  <a name="160" href="#160">160</a>             processedString = resolveVariables(suite.getURL());
  <a name="161" href="#161">161</a>         }
  <a name="162" href="#162">162</a>         suite.setReader(<b>new</b> StringReader(processedString));
  <a name="163" href="#163">163</a> 
  <a name="164" href="#164">164</a>         <font color="#329900"><i>// entities will be processed during the SAX parse</font></i>
  <a name="165" href="#165">165</a>     }  
  <a name="166" href="#166">166</a> 
  <a name="167" href="#167">167</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="168" href="#168">168</a> <font color="#AA0000"><i>     * Given an XML suite, find the names </font></i>
  <a name="169" href="#169">169</a> <font color="#AA0000"><i>     * of all variables that must be set in the LatkaProperties.</font></i>
  <a name="170" href="#170">170</a> <font color="#AA0000"><i>     * Will use SAX to recurse through external entities.</font></i>
  <a name="171" href="#171">171</a> <font color="#AA0000"><i>     * </font></i>
  <a name="172" href="#172">172</a> <font color="#AA0000"><i>     * @param suite A Latka suite</font></i>
  <a name="173" href="#173">173</a> <font color="#AA0000"><i>     * @throws IOException when variables can't be resolved or resources</font></i>
  <a name="174" href="#174">174</a> <font color="#AA0000"><i>     *         aren't accessible</font></i>
  <a name="175" href="#175">175</a> <font color="#AA0000"><i>     * @return Array of variables that must be set.  If no variables</font></i>
  <a name="176" href="#176">176</a> <font color="#AA0000"><i>     *         are present in the suite, a zero-length Set is</font></i>
  <a name="177" href="#177">177</a> <font color="#AA0000"><i>     *         returned.</font></i>
  <a name="178" href="#178">178</a> <font color="#AA0000"><i>     * @see org.apache.commons.latka.LatkaProperties</font></i>
  <a name="179" href="#179">179</a> <font color="#AA0000"><i>     */</font></i>
  <a name="180" href="#180">180</a>     <b>public</b> Set findVariables(<a href="../../../../../org/apache/commons/latka/Suite.html">Suite</a> suite) throws IOException {
  <a name="181" href="#181">181</a> 
  <a name="182" href="#182">182</a>         <font color="#329900"><i>// first, get variables for the base document</font></i>
  <a name="183" href="#183">183</a>         String xml = <b>null</b>;
  <a name="184" href="#184">184</a>         <b>if</b> (suite.getReader() != <b>null</b>) {
  <a name="185" href="#185">185</a>             xml = stringFromReader(suite.getReader()).trim();
  <a name="186" href="#186">186</a>         } <b>else</b> {
  <a name="187" href="#187">187</a>             Reader reader = <b>new</b> InputStreamReader(suite
  <a name="188" href="#188">188</a>                                                   .getURL()
  <a name="189" href="#189">189</a>                                                   .openConnection()
  <a name="190" href="#190">190</a>                                                   .getInputStream());
  <a name="191" href="#191">191</a>             xml = stringFromReader(reader).trim();
  <a name="192" href="#192">192</a>         }
  <a name="193" href="#193">193</a>         <font color="#329900"><i>// accumulate the sets from the Reader and all</font></i>
  <a name="194" href="#194">194</a>         <font color="#329900"><i>// external entities here</font></i>
  <a name="195" href="#195">195</a>         Set set = getLocalVariables(xml);
  <a name="196" href="#196">196</a> 
  <a name="197" href="#197">197</a>         <font color="#329900"><i>// now that we have variables from the initial document,</font></i>
  <a name="198" href="#198">198</a>         <font color="#329900"><i>// perform a SAX parse to find additional variables</font></i>
  <a name="199" href="#199">199</a>         <font color="#329900"><i>// in external entities</font></i>
  <a name="200" href="#200">200</a>         InputSource source = <b>new</b> InputSource(<b>new</b> StringReader(xml));
  <a name="201" href="#201">201</a>         <b>if</b> (suite.getURL() != <b>null</b>) {
  <a name="202" href="#202">202</a>             source.setSystemId(suite.getURL().toString());
  <a name="203" href="#203">203</a>         }
  <a name="204" href="#204">204</a>         set.addAll(getVariablesFromEntities(source));
  <a name="205" href="#205">205</a> 
  <a name="206" href="#206">206</a>         <b>return</b> set;
  <a name="207" href="#207">207</a> 
  <a name="208" href="#208">208</a>     }
  <a name="209" href="#209">209</a> 
  <a name="210" href="#210">210</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="211" href="#211">211</a> <font color="#AA0000"><i>     * @param inputSource source of xml to use for resolution</font></i>
  <a name="212" href="#212">212</a> <font color="#AA0000"><i>     * @throws IOException when variables can't be resolved</font></i>
  <a name="213" href="#213">213</a> <font color="#AA0000"><i>     * @return a set of Latka variables</font></i>
  <a name="214" href="#214">214</a> <font color="#AA0000"><i>     * @deprecated Spelling -- use {@link #getVariablesFromEntities} instead.</font></i>
  <a name="215" href="#215">215</a> <font color="#AA0000"><i>     */</font></i>
  <a name="216" href="#216">216</a>     <b>protected</b> Set getVariablesFromEntites(InputSource inputSource) 
  <a name="217" href="#217">217</a>         throws IOException {
  <a name="218" href="#218">218</a>         <b>return</b> getVariablesFromEntities(inputSource);
  <a name="219" href="#219">219</a>     }
  <a name="220" href="#220">220</a> 
  <a name="221" href="#221">221</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="222" href="#222">222</a> <font color="#AA0000"><i>     * This method uses a special SAX handler to recurse</font></i>
  <a name="223" href="#223">223</a> <font color="#AA0000"><i>     * through the entities of a Latka Suite, finding all</font></i>
  <a name="224" href="#224">224</a> <font color="#AA0000"><i>     * the variables that are referenced.</font></i>
  <a name="225" href="#225">225</a> <font color="#AA0000"><i>     * </font></i>
  <a name="226" href="#226">226</a> <font color="#AA0000"><i>     * @param inputSource SAX InputSource containing the Latka Suite</font></i>
  <a name="227" href="#227">227</a> <font color="#AA0000"><i>     * @return Set of unique Latka variables references in the entities</font></i>
  <a name="228" href="#228">228</a> <font color="#AA0000"><i>     * @throws IOException if any errors occur during the XML processing</font></i>
  <a name="229" href="#229">229</a> <font color="#AA0000"><i>     */</font></i>
  <a name="230" href="#230">230</a>     <b>protected</b> Set getVariablesFromEntities(InputSource inputSource) 
  <a name="231" href="#231">231</a>         throws IOException {
  <a name="232" href="#232">232</a>         SAXParserFactory factory = SAXParserFactory.newInstance();
  <a name="233" href="#233">233</a>         factory.setNamespaceAware(<b>true</b>);
  <a name="234" href="#234">234</a> 
  <a name="235" href="#235">235</a>         <a href="../../../../../org/apache/commons/latka/xml/FindVariablesHandler.html">FindVariablesHandler</a> handler = <b>new</b> <a href="../../../../../org/apache/commons/latka/xml/FindVariablesHandler.html">FindVariablesHandler</a>();
  <a name="236" href="#236">236</a>     
  <a name="237" href="#237">237</a>         <b>try</b> {
  <a name="238" href="#238">238</a>             SAXParser parser = factory.newSAXParser();
  <a name="239" href="#239">239</a>       
  <a name="240" href="#240">240</a>             parser.parse(inputSource, handler);
  <a name="241" href="#241">241</a>         } <b>catch</b> (ParserConfigurationException e) {
  <a name="242" href="#242">242</a>             <b>throw</b> <b>new</b> IOException(e.toString());
  <a name="243" href="#243">243</a>         } <b>catch</b> (SAXException e) {
  <a name="244" href="#244">244</a>             <b>throw</b> <b>new</b> IOException(e.toString());
  <a name="245" href="#245">245</a>         }
  <a name="246" href="#246">246</a> 
  <a name="247" href="#247">247</a>         <b>return</b> handler.getVariables();
  <a name="248" href="#248">248</a>     }
  <a name="249" href="#249">249</a>   
  <a name="250" href="#250">250</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="251" href="#251">251</a> <font color="#AA0000"><i>     * </font></i>
  <a name="252" href="#252">252</a> <font color="#AA0000"><i>     * @see #getLocalVariables(String)</font></i>
  <a name="253" href="#253">253</a> <font color="#AA0000"><i>     */</font></i>
  <a name="254" href="#254">254</a>     <b>protected</b> Set getLocalVariables(Reader reader) throws IOException {
  <a name="255" href="#255">255</a>         String xmlString = stringFromReader(reader).trim();
  <a name="256" href="#256">256</a>         <b>return</b> getLocalVariables(xmlString);
  <a name="257" href="#257">257</a>     }
  <a name="258" href="#258">258</a> 
  <a name="259" href="#259">259</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="260" href="#260">260</a> <font color="#AA0000"><i>     * Read the text and find the names of all variables </font></i>
  <a name="261" href="#261">261</a> <font color="#AA0000"><i>     * that must be set in the LatkaProperties.  This method does not</font></i>
  <a name="262" href="#262">262</a> <font color="#AA0000"><i>     * recurse through entities like findVariables.</font></i>
  <a name="263" href="#263">263</a> <font color="#AA0000"><i>     * </font></i>
  <a name="264" href="#264">264</a> <font color="#AA0000"><i>     * @param xmlString a Latka suite fragment</font></i>
  <a name="265" href="#265">265</a> <font color="#AA0000"><i>     * @return Set of variables used in this fragment.  If no variables</font></i>
  <a name="266" href="#266">266</a> <font color="#AA0000"><i>     *         are present in the suite, a zero-length Set is</font></i>
  <a name="267" href="#267">267</a> <font color="#AA0000"><i>     *         returned.</font></i>
  <a name="268" href="#268">268</a> <font color="#AA0000"><i>     * @see org.apache.commons.latka.LatkaProperties</font></i>
  <a name="269" href="#269">269</a> <font color="#AA0000"><i>     */</font></i>
  <a name="270" href="#270">270</a>     <b>protected</b> Set getLocalVariables(String xmlString) {
  <a name="271" href="#271">271</a>     
  <a name="272" href="#272">272</a>         xmlString = stripXmlComments(xmlString);
  <a name="273" href="#273">273</a> 
  <a name="274" href="#274">274</a>         Set set = <b>new</b> TreeSet();
  <a name="275" href="#275">275</a> 
  <a name="276" href="#276">276</a>         <b>try</b> {
  <a name="277" href="#277">277</a>             RE r = <b>new</b> RE(_variableExpr);  <font color="#329900"><i>// Compile expression</font></i>
  <a name="278" href="#278">278</a> 
  <a name="279" href="#279">279</a>             <font color="#329900"><i>//scan the input string match by match</font></i>
  <a name="280" href="#280">280</a>             <b>int</b> bufIndex = 0;
  <a name="281" href="#281">281</a> 
  <a name="282" href="#282">282</a>             <b>while</b> (r.match(xmlString, bufIndex)) {
  <a name="283" href="#283">283</a>                 set.add(r.getParen(1));
  <a name="284" href="#284">284</a>                 bufIndex = r.getParenEnd(0);
  <a name="285" href="#285">285</a>             }
  <a name="286" href="#286">286</a>         } <b>catch</b> (RESyntaxException e) {
  <a name="287" href="#287">287</a>             <font color="#329900"><i>// FIXME: should this really be swallowed?</font></i>
  <a name="288" href="#288">288</a>             e.printStackTrace();
  <a name="289" href="#289">289</a>         }
  <a name="290" href="#290">290</a> 
  <a name="291" href="#291">291</a>         <b>return</b> set;
  <a name="292" href="#292">292</a> 
  <a name="293" href="#293">293</a>     }
  <a name="294" href="#294">294</a> 
  <a name="295" href="#295">295</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="296" href="#296">296</a> <font color="#AA0000"><i>     * @see #resolveVariables(String) </font></i>
  <a name="297" href="#297">297</a> <font color="#AA0000"><i>     */</font></i>
  <a name="298" href="#298">298</a>     <b>protected</b> String resolveVariables(URL url) throws IOException {
  <a name="299" href="#299">299</a>         Reader reader = <b>new</b> InputStreamReader(url.openConnection()
  <a name="300" href="#300">300</a>                                              .getInputStream());
  <a name="301" href="#301">301</a>         <b>return</b> resolveVariables(stringFromReader(reader));
  <a name="302" href="#302">302</a>     }
  <a name="303" href="#303">303</a> 
  <a name="304" href="#304">304</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="305" href="#305">305</a> <font color="#AA0000"><i>     * Given an XML suite, find the corresponding values</font></i>
  <a name="306" href="#306">306</a> <font color="#AA0000"><i>     * of all variables and write them into the stream.</font></i>
  <a name="307" href="#307">307</a> <font color="#AA0000"><i>     * </font></i>
  <a name="308" href="#308">308</a> <font color="#AA0000"><i>     * @param xmlString XML String representing a Latka suite</font></i>
  <a name="309" href="#309">309</a> <font color="#AA0000"><i>     * @return XML String with all variables resolved</font></i>
  <a name="310" href="#310">310</a> <font color="#AA0000"><i>     * @throws IOException if a Latka variable could not be resolved</font></i>
  <a name="311" href="#311">311</a> <font color="#AA0000"><i>     */</font></i>
  <a name="312" href="#312">312</a>     <b>protected</b> String resolveVariables(String xmlString) throws IOException {
  <a name="313" href="#313">313</a> 
  <a name="314" href="#314">314</a>         StringBuffer output = <b>new</b> StringBuffer();
  <a name="315" href="#315">315</a> 
  <a name="316" href="#316">316</a>         Properties props = LatkaProperties.getProperties();
  <a name="317" href="#317">317</a> 
  <a name="318" href="#318">318</a>         <b>try</b> {
  <a name="319" href="#319">319</a>       
  <a name="320" href="#320">320</a>             xmlString = stripXmlComments(xmlString);
  <a name="321" href="#321">321</a> 
  <a name="322" href="#322">322</a>             <font color="#329900"><i>// now, replace the remaining variables</font></i>
  <a name="323" href="#323">323</a>             RE r = <b>new</b> RE(_variableExpr);  <font color="#329900"><i>// Compile expression</font></i>
  <a name="324" href="#324">324</a> 
  <a name="325" href="#325">325</a>             <font color="#329900"><i>//scan the input string match by match, writing to the buffer</font></i>
  <a name="326" href="#326">326</a>             <b>int</b> bufIndex = 0;
  <a name="327" href="#327">327</a> 
  <a name="328" href="#328">328</a>             <b>while</b> (r.match(xmlString, bufIndex)) {
  <a name="329" href="#329">329</a>                 <font color="#329900"><i>// append everything to the beginning of the match</font></i>
  <a name="330" href="#330">330</a>                 output.append(xmlString.substring(bufIndex,
  <a name="331" href="#331">331</a>                                                   r.getParenStart(0)));
  <a name="332" href="#332">332</a>                 <font color="#329900"><i>// move marker to the end of the match</font></i>
  <a name="333" href="#333">333</a>                 bufIndex = r.getParenEnd(0);
  <a name="334" href="#334">334</a> 
  <a name="335" href="#335">335</a>                 String prop = props.getProperty(r.getParen(1));
  <a name="336" href="#336">336</a>                 <b>if</b> (prop == <b>null</b>) {
  <a name="337" href="#337">337</a>                     <b>throw</b> <b>new</b> IOException(<font color="#000099">"Property "</font> + 
  <a name="338" href="#338">338</a>                                           r.getParen(1) + 
  <a name="339" href="#339">339</a>                                           <font color="#000099">" was not defined."</font>);
  <a name="340" href="#340">340</a>                 }
  <a name="341" href="#341">341</a>                 <font color="#329900"><i>// append the substituted value to the end of the output</font></i>
  <a name="342" href="#342">342</a>                 output.append(prop);
  <a name="343" href="#343">343</a>             }
  <a name="344" href="#344">344</a> 
  <a name="345" href="#345">345</a>             <font color="#329900"><i>// grab anything remaining that did not match</font></i>
  <a name="346" href="#346">346</a>             output.append(xmlString.substring(bufIndex, xmlString.length()));
  <a name="347" href="#347">347</a>         } <b>catch</b> (RESyntaxException e) {
  <a name="348" href="#348">348</a>             <font color="#329900"><i>// FIXME: Should this really be swallowed?</font></i>
  <a name="349" href="#349">349</a>             e.printStackTrace();
  <a name="350" href="#350">350</a>         }
  <a name="351" href="#351">351</a> 
  <a name="352" href="#352">352</a>         String outputString = output.toString();
  <a name="353" href="#353">353</a> 
  <a name="354" href="#354">354</a>         <b>return</b> outputString;
  <a name="355" href="#355">355</a> 
  <a name="356" href="#356">356</a>     }
  <a name="357" href="#357">357</a> 
  <a name="358" href="#358">358</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="359" href="#359">359</a> <font color="#AA0000"><i>     * Given a Latka suite, resolve all the entites</font></i>
  <a name="360" href="#360">360</a> <font color="#AA0000"><i>     * (but _not_ the Latka variables), and return one flattened</font></i>
  <a name="361" href="#361">361</a> <font color="#AA0000"><i>     * XML document.  This utility method is useful for</font></i>
  <a name="362" href="#362">362</a> <font color="#AA0000"><i>     * viewing an XML suite as a single document.</font></i>
  <a name="363" href="#363">363</a> <font color="#AA0000"><i>     * </font></i>
  <a name="364" href="#364">364</a> <font color="#AA0000"><i>     * @param suite  a Latka suite</font></i>
  <a name="365" href="#365">365</a> <font color="#AA0000"><i>     * @return flattened XML</font></i>
  <a name="366" href="#366">366</a> <font color="#AA0000"><i>     * @throws IOException if the Latka suite could not be transformed</font></i>
  <a name="367" href="#367">367</a> <font color="#AA0000"><i>     */</font></i>
  <a name="368" href="#368">368</a>     <b>public</b> String identityTransform(<a href="../../../../../org/apache/commons/latka/Suite.html">Suite</a> suite) throws IOException {
  <a name="369" href="#369">369</a> 
  <a name="370" href="#370">370</a>         _log.debug(<font color="#000099">"Setting up transform streams"</font>);
  <a name="371" href="#371">371</a> 
  <a name="372" href="#372">372</a>         StreamSource source = <b>new</b> StreamSource();
  <a name="373" href="#373">373</a>         <b>if</b> (suite.getReader() != <b>null</b>) {
  <a name="374" href="#374">374</a>             _log.debug(<font color="#000099">"Setting input reader"</font>);
  <a name="375" href="#375">375</a>             source.setReader(suite.getReader());
  <a name="376" href="#376">376</a>         }
  <a name="377" href="#377">377</a>         <b>if</b> (suite.getURL() != <b>null</b>) {
  <a name="378" href="#378">378</a>             _log.debug(<font color="#000099">"Setting input URL"</font>);
  <a name="379" href="#379">379</a>             source.setSystemId(suite.getURL().toString());
  <a name="380" href="#380">380</a>         }
  <a name="381" href="#381">381</a> 
  <a name="382" href="#382">382</a>         StringWriter output = <b>new</b> StringWriter();
  <a name="383" href="#383">383</a>         StreamResult result = <b>new</b> StreamResult(output);
  <a name="384" href="#384">384</a> 
  <a name="385" href="#385">385</a>         _log.debug(<font color="#000099">"Performing transformation"</font>);
  <a name="386" href="#386">386</a> 
  <a name="387" href="#387">387</a>         <b>try</b> {
  <a name="388" href="#388">388</a>             <font color="#329900"><i>// we should be able to do identity transforms via </font></i>
  <a name="389" href="#389">389</a>             <font color="#329900"><i>// TransformerFactory.newTransformer(), but this seems broken in </font></i>
  <a name="390" href="#390">390</a>             <font color="#329900"><i>// Xalan 2.1.0, so...</font></i>
  <a name="391" href="#391">391</a>             ClassLoader loader = Thread.currentThread().getContextClassLoader();
  <a name="392" href="#392">392</a>             StreamSource xslSource = <b>new</b> StreamSource(
  <a name="393" href="#393">393</a>                         loader.getResourceAsStream(
  <a name="394" href="#394">394</a>                             <font color="#000099">"org.apache.commons.latka.identityTransform.xsl"</font>));
  <a name="395" href="#395">395</a>       
  <a name="396" href="#396">396</a>             Transformer transformer = TransformerFactory.newInstance()
  <a name="397" href="#397">397</a>                                         .newTransformer(xslSource);
  <a name="398" href="#398">398</a>             transformer.transform(source, result);
  <a name="399" href="#399">399</a>         } <b>catch</b> (TransformerException e) {
  <a name="400" href="#400">400</a>             _log.error(e);
  <a name="401" href="#401">401</a>             <b>throw</b> <b>new</b> IOException(e.toString());
  <a name="402" href="#402">402</a>         }
  <a name="403" href="#403">403</a> 
  <a name="404" href="#404">404</a>         <b>if</b> (_log.isDebugEnabled()) {
  <a name="405" href="#405">405</a>             _log.debug(<font color="#000099">"Transformation output: \n"</font> + output.toString());
  <a name="406" href="#406">406</a>         }
  <a name="407" href="#407">407</a> 
  <a name="408" href="#408">408</a>         <b>return</b> output.toString();
  <a name="409" href="#409">409</a> 
  <a name="410" href="#410">410</a>     }
  <a name="411" href="#411">411</a> 
  <a name="412" href="#412">412</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="413" href="#413">413</a> <font color="#AA0000"><i>     * Remove any comments from the XmlString</font></i>
  <a name="414" href="#414">414</a> <font color="#AA0000"><i>     * </font></i>
  <a name="415" href="#415">415</a> <font color="#AA0000"><i>     * @param xmlString String with XML comments</font></i>
  <a name="416" href="#416">416</a> <font color="#AA0000"><i>     * @return String with no XML comments</font></i>
  <a name="417" href="#417">417</a> <font color="#AA0000"><i>     */</font></i>
  <a name="418" href="#418">418</a>     <b>protected</b> String stripXmlComments(String xmlString) {
  <a name="419" href="#419">419</a>         <b>try</b> {
  <a name="420" href="#420">420</a>             <font color="#329900"><i>//remove anything commented out</font></i>
  <a name="421" href="#421">421</a>             RE removeComments = <b>new</b> RE(<font color="#000099">"&lt;!--.*?--&gt;"</font>, RE.MATCH_SINGLELINE);
  <a name="422" href="#422">422</a>             xmlString = removeComments.subst(xmlString, <font color="#000099">""</font>);
  <a name="423" href="#423">423</a>         } <b>catch</b> (RESyntaxException e) {
  <a name="424" href="#424">424</a>             <font color="#329900"><i>// FIXME: Should this really be swallowed?</font></i>
  <a name="425" href="#425">425</a>             e.printStackTrace();
  <a name="426" href="#426">426</a>         }
  <a name="427" href="#427">427</a> 
  <a name="428" href="#428">428</a>         <b>return</b> xmlString;
  <a name="429" href="#429">429</a>     }
  <a name="430" href="#430">430</a> 
  <a name="431" href="#431">431</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="432" href="#432">432</a> <font color="#AA0000"><i>     * Place the contents of a Reader into a String.</font></i>
  <a name="433" href="#433">433</a> <font color="#AA0000"><i>     * </font></i>
  <a name="434" href="#434">434</a> <font color="#AA0000"><i>     * @param reader text in a Reader</font></i>
  <a name="435" href="#435">435</a> <font color="#AA0000"><i>     * @return text stored as a String</font></i>
  <a name="436" href="#436">436</a> <font color="#AA0000"><i>     * @exception IOException if the Reader could not be accessed</font></i>
  <a name="437" href="#437">437</a> <font color="#AA0000"><i>     */</font></i>
  <a name="438" href="#438">438</a>     <b>protected</b> String stringFromReader(Reader reader) throws IOException {
  <a name="439" href="#439">439</a> 
  <a name="440" href="#440">440</a>         BufferedReader buffReader = <b>new</b> BufferedReader(reader);
  <a name="441" href="#441">441</a> 
  <a name="442" href="#442">442</a>         StringBuffer buff = <b>new</b> StringBuffer();
  <a name="443" href="#443">443</a> 
  <a name="444" href="#444">444</a>         <font color="#329900"><i>// FIXME: Is this really the most efficient way to do it, per line?</font></i>
  <a name="445" href="#445">445</a>         String line = buffReader.readLine();
  <a name="446" href="#446">446</a>         <b>while</b> (line != <b>null</b>) {
  <a name="447" href="#447">447</a>             buff.append(line);
  <a name="448" href="#448">448</a>             buff.append(<font color="#000099">"\n"</font>);
  <a name="449" href="#449">449</a>             line = buffReader.readLine();
  <a name="450" href="#450">450</a>         }
  <a name="451" href="#451">451</a> 
  <a name="452" href="#452">452</a>         reader.close();
  <a name="453" href="#453">453</a> 
  <a name="454" href="#454">454</a>         <b>return</b> buff.toString();
  <a name="455" href="#455">455</a>     }
  <a name="456" href="#456">456</a> }                         
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/ValidationReflectionHandler.html
  
  Index: ValidationReflectionHandler.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/ValidationReflectionHandler.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>   
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> java.beans.Beans;
  <a name="63" href="#63">63</a>  
  <a name="64" href="#64">64</a>  <b>import</b> java.io.IOException;
  <a name="65" href="#65">65</a>  
  <a name="66" href="#66">66</a>  <b>import</b> java.util.Enumeration;
  <a name="67" href="#67">67</a>  <b>import</b> java.util.Properties;
  <a name="68" href="#68">68</a>  
  <a name="69" href="#69">69</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/index.html">org.apache.commons.latka</a>.<a href="../../../../../org/apache/commons/latka/LatkaProperties.html">LatkaProperties</a>;
  <a name="70" href="#70">70</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/event/index.html">org.apache.commons.latka.event</a>.<a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a>;
  <a name="71" href="#71">71</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a>;
  <a name="72" href="#72">72</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a>;
  <a name="73" href="#73">73</a>  
  <a name="74" href="#74">74</a>  <b>import</b> org.apache.log4j.Category;
  <a name="75" href="#75">75</a>  
  <a name="76" href="#76">76</a>  <b>import</b> org.xml.sax.Attributes;
  <a name="77" href="#77">77</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="78" href="#78">78</a>  <b>import</b> org.xml.sax.XMLReader;
  <a name="79" href="#79">79</a>  
  <a name="80" href="#80">80</a>  <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="81" href="#81">81</a>  <font color="#AA0000"><i> * A special LatkaHandler that processes validator tags, and loads the</font></i>
  <a name="82" href="#82">82</a>  <font color="#AA0000"><i> * classes to process the tags on demand</font></i>
  <a name="83" href="#83">83</a>  <font color="#AA0000"><i> * &lt;br /&gt;This allows for pluggable tag handling</font></i>
  <a name="84" href="#84">84</a>  <font color="#AA0000"><i> * @author Morgan Delagrange</font></i>
  <a name="85" href="#85">85</a>  <font color="#AA0000"><i> * @author dIon Gillard</font></i>
  <a name="86" href="#86">86</a>  <font color="#AA0000"><i> * @version $Id: ValidationReflectionHandler.html,v 1.1 2002/04/01 05:46:02 dion Exp $</font></i>
  <a name="87" href="#87">87</a>  <font color="#AA0000"><i> */</font></i>
  <a name="88" href="#88">88</a>  <b>public</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/ValidationReflectionHandler.html">ValidationReflectionHandler</a> <b>extends</b> <a href="../../../../../org/apache/commons/latka/xml/LatkaHandler.html">LatkaHandler</a> {
  <a name="89" href="#89">89</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* the request processed to obtain the response being validated */</font></i></font></i>
  <a name="90" href="#90">90</a>      <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a>  _request  = <b>null</b>;
  <a name="91" href="#91">91</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* the response being validated */</font></i></font></i>
  <a name="92" href="#92">92</a>      <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a> _response = <b>null</b>;
  <a name="93" href="#93">93</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* holds request success/failure details */</font></i></font></i>
  <a name="94" href="#94">94</a>      <b>protected</b> <a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a> _listener = <b>null</b>;
  <a name="95" href="#95">95</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* properties prefix for tags */</font></i></font></i>
  <a name="96" href="#96">96</a>      <b>protected</b> <b>static</b> String _latkaPrefix = <font color="#000099">"latka.validator."</font>;
  <a name="97" href="#97">97</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* context classloader for loading classes */</font></i></font></i>
  <a name="98" href="#98">98</a>      <b>protected</b> ClassLoader _loader = 
  <a name="99" href="#99">99</a>                  Thread.currentThread().getContextClassLoader();
  <a name="100" href="#100">100</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>* log4j category to append output to */</font></i></font></i>
  <a name="101" href="#101">101</a>     <b>protected</b> <b>static</b> <b>final</b> Category log = 
  <a name="102" href="#102">102</a>         Category.getInstance(ValidationReflectionHandler.<b>class</b>);
  <a name="103" href="#103">103</a> 
  <a name="104" href="#104">104</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="105" href="#105">105</a> <font color="#AA0000"><i>     * Create a handler to deal with validator tags and sub tags</font></i>
  <a name="106" href="#106">106</a> <font color="#AA0000"><i>     * @param reader source of XML fragment</font></i>
  <a name="107" href="#107">107</a> <font color="#AA0000"><i>     * @param response the response being validated</font></i>
  <a name="108" href="#108">108</a> <font color="#AA0000"><i>     * @param listener holds request success/failure details</font></i>
  <a name="109" href="#109">109</a> <font color="#AA0000"><i>     */</font></i>    
  <a name="110" href="#110">110</a>     <b>public</b> <a href="../../../../../org/apache/commons/latka/xml/ValidationReflectionHandler.html">ValidationReflectionHandler</a>(XMLReader reader, <a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a> response, 
  <a name="111" href="#111">111</a>                                      <a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a> listener) {
  <a name="112" href="#112">112</a>         <b>super</b>(reader);
  <a name="113" href="#113">113</a>         _response = response;
  <a name="114" href="#114">114</a>         _request  = response.getRequest();
  <a name="115" href="#115">115</a>         _listener = listener;
  <a name="116" href="#116">116</a>     }
  <a name="117" href="#117">117</a> 
  <a name="118" href="#118">118</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="119" href="#119">119</a> <font color="#AA0000"><i>     * Handle the start of element</font></i>
  <a name="120" href="#120">120</a> <font color="#AA0000"><i>     * &lt;br /&gt;If the request has failed, skip processing</font></i>
  <a name="121" href="#121">121</a> <font color="#AA0000"><i>     * &lt;br /&gt;If it's the start of a validate tag, do nothing</font></i>
  <a name="122" href="#122">122</a> <font color="#AA0000"><i>     * &lt;br /&gt;Otherwise, load the handler (based on localName) and delegate</font></i>
  <a name="123" href="#123">123</a> <font color="#AA0000"><i>     * to it</font></i>
  <a name="124" href="#124">124</a> <font color="#AA0000"><i>     *</font></i>
  <a name="125" href="#125">125</a> <font color="#AA0000"><i>     * @param uri namespace URI if namespace processing is being done</font></i>
  <a name="126" href="#126">126</a> <font color="#AA0000"><i>     * @param localName The element type name</font></i>
  <a name="127" href="#127">127</a> <font color="#AA0000"><i>     * @param qName fully qualified element name</font></i>
  <a name="128" href="#128">128</a> <font color="#AA0000"><i>     * @param atts The specified or defaulted attributes</font></i>
  <a name="129" href="#129">129</a> <font color="#AA0000"><i>     * @throws SAXException when any error occurs</font></i>
  <a name="130" href="#130">130</a> <font color="#AA0000"><i>     */</font></i>
  <a name="131" href="#131">131</a>     <b>public</b> <b>void</b> startElement(String uri, String localName, String qName, 
  <a name="132" href="#132">132</a>                              Attributes atts) throws SAXException {
  <a name="133" href="#133">133</a> 
  <a name="134" href="#134">134</a>         <b>if</b> (_listener.didRequestSucceed(_request) == false) {
  <a name="135" href="#135">135</a>             <font color="#329900"><i>// once a validator fails, skip the rest</font></i>
  <a name="136" href="#136">136</a>             <b>return</b>;
  <a name="137" href="#137">137</a>         }
  <a name="138" href="#138">138</a> 
  <a name="139" href="#139">139</a>         <b>if</b> (localName.equals(<font color="#000099">"validate"</font>)) {
  <a name="140" href="#140">140</a>             <b>return</b>;
  <a name="141" href="#141">141</a>         }
  <a name="142" href="#142">142</a> 
  <a name="143" href="#143">143</a>         <font color="#329900"><i>// the name of the custom ValidatorHandler class</font></i>
  <a name="144" href="#144">144</a>         String validatorName = tagNameToClass(localName);
  <a name="145" href="#145">145</a>         <b>if</b> (validatorName == <b>null</b>) {
  <a name="146" href="#146">146</a>             log.debug(<font color="#000099">"Unrecognized tag name for custom validator: "</font>
  <a name="147" href="#147">147</a>                       + localName);
  <a name="148" href="#148">148</a>             <b>return</b>;
  <a name="149" href="#149">149</a>         }
  <a name="150" href="#150">150</a> 
  <a name="151" href="#151">151</a>         log.info(<font color="#000099">"Custom validator class: "</font> + validatorName);
  <a name="152" href="#152">152</a>         log.debug(<font color="#000099">"response = "</font> + _response);
  <a name="153" href="#153">153</a>         <a href="../../../../../org/apache/commons/latka/xml/ValidationHandler.html">ValidationHandler</a> validator = handlerForClass(validatorName);
  <a name="154" href="#154">154</a>         validator.init(_reader, _response, _listener, localName);
  <a name="155" href="#155">155</a>         log.debug(<font color="#000099">"delegating tag: "</font> + localName);
  <a name="156" href="#156">156</a>         validator.delegate(uri, localName, qName, atts);
  <a name="157" href="#157">157</a> 
  <a name="158" href="#158">158</a>     }
  <a name="159" href="#159">159</a> 
  <a name="160" href="#160">160</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="161" href="#161">161</a> <font color="#AA0000"><i>     * at the end of the tag, release resources</font></i>
  <a name="162" href="#162">162</a> <font color="#AA0000"><i>     * @param namespaceURI - The Namespace URI, or the empty string if the</font></i>
  <a name="163" href="#163">163</a> <font color="#AA0000"><i>     *      element has no Namespace URI or if Namespace processing is not </font></i>
  <a name="164" href="#164">164</a> <font color="#AA0000"><i>     *      being performed.</font></i>
  <a name="165" href="#165">165</a> <font color="#AA0000"><i>     * @param localName - The local name (without prefix), or the empty string</font></i>
  <a name="166" href="#166">166</a> <font color="#AA0000"><i>     *      if Namespace processing is not being performed.</font></i>
  <a name="167" href="#167">167</a> <font color="#AA0000"><i>     * @param rawName - The qualified XML 1.0 name (with prefix), or the empty</font></i>
  <a name="168" href="#168">168</a> <font color="#AA0000"><i>     *      string if qualified names are not available.</font></i>
  <a name="169" href="#169">169</a> <font color="#AA0000"><i>     */</font></i>
  <a name="170" href="#170">170</a>     <b>public</b> <b>void</b> endElement(String namespaceURI, String localName, 
  <a name="171" href="#171">171</a>                            String rawName) {
  <a name="172" href="#172">172</a>         <b>if</b> (localName.equals(<font color="#000099">"validate"</font>)) {
  <a name="173" href="#173">173</a>             release();
  <a name="174" href="#174">174</a>         }
  <a name="175" href="#175">175</a>     }
  <a name="176" href="#176">176</a> 
  <a name="177" href="#177">177</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="178" href="#178">178</a> <font color="#AA0000"><i>     * Return a class name for the validator tag given</font></i>
  <a name="179" href="#179">179</a> <font color="#AA0000"><i>     * @return a class name for the validator tag given</font></i>
  <a name="180" href="#180">180</a> <font color="#AA0000"><i>     * @param localName the validator tag name</font></i>
  <a name="181" href="#181">181</a> <font color="#AA0000"><i>     */</font></i>
  <a name="182" href="#182">182</a>     <b>protected</b> String tagNameToClass(String localName) {
  <a name="183" href="#183">183</a>         Properties props = LatkaProperties.getProperties();
  <a name="184" href="#184">184</a>         Enumeration e = props.propertyNames();
  <a name="185" href="#185">185</a>         <b>while</b> (e.hasMoreElements()) {
  <a name="186" href="#186">186</a>             String name = (String) e.nextElement();
  <a name="187" href="#187">187</a>             <font color="#329900"><i>// FIXME: Should use endsWith localName as this should be less</font></i>
  <a name="188" href="#188">188</a>             <font color="#329900"><i>// common</font></i>
  <a name="189" href="#189">189</a>             <b>if</b> (name.startsWith(_latkaPrefix)) {
  <a name="190" href="#190">190</a>                 <b>int</b> index = name.indexOf(_latkaPrefix) + _latkaPrefix.length();
  <a name="191" href="#191">191</a>                 String tagName = name.substring(index, name.length());
  <a name="192" href="#192">192</a>                 <b>if</b> (localName.equals(tagName)) {
  <a name="193" href="#193">193</a>                     <b>return</b> props.getProperty(name);
  <a name="194" href="#194">194</a>                 }
  <a name="195" href="#195">195</a>             }
  <a name="196" href="#196">196</a>         }
  <a name="197" href="#197">197</a> 
  <a name="198" href="#198">198</a>         <b>return</b> <b>null</b>;
  <a name="199" href="#199">199</a>     }
  <a name="200" href="#200">200</a> 
  <a name="201" href="#201">201</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>* </font></i></font></i>
  <a name="202" href="#202">202</a> <font color="#AA0000"><i>     * Provide a validation handler by loading the provided class.</font></i>
  <a name="203" href="#203">203</a> <font color="#AA0000"><i>     * @return a validation handler by loading the provided class</font></i>
  <a name="204" href="#204">204</a> <font color="#AA0000"><i>     * @param validatorClass class name of the validator to be loaded</font></i>
  <a name="205" href="#205">205</a> <font color="#AA0000"><i>     * @throws SAXException when there are issues loading the class</font></i>
  <a name="206" href="#206">206</a> <font color="#AA0000"><i>     */</font></i>
  <a name="207" href="#207">207</a>     <b>protected</b> <a href="../../../../../org/apache/commons/latka/xml/ValidationHandler.html">ValidationHandler</a> handlerForClass(String validatorClass) 
  <a name="208" href="#208">208</a>     throws SAXException {
  <a name="209" href="#209">209</a>         <b>try</b> {
  <a name="210" href="#210">210</a>             <b>return</b> (ValidationHandler) Beans.instantiate(_loader, 
  <a name="211" href="#211">211</a>                                                          validatorClass);
  <a name="212" href="#212">212</a>         } <b>catch</b> (ClassNotFoundException e) {
  <a name="213" href="#213">213</a>             <b>throw</b> <b>new</b> SAXException(e);
  <a name="214" href="#214">214</a>         } <b>catch</b> (IOException e) {
  <a name="215" href="#215">215</a>             <b>throw</b> <b>new</b> SAXException(e);
  <a name="216" href="#216">216</a>         }
  <a name="217" href="#217">217</a>     }
  <a name="218" href="#218">218</a> }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/ValidationHandler.html
  
  Index: ValidationHandler.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/ValidationHandler.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>   
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/index.html">org.apache.commons.latka</a>.<a href="../../../../../org/apache/commons/latka/Validator.html">Validator</a>;
  <a name="63" href="#63">63</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/index.html">org.apache.commons.latka</a>.<a href="../../../../../org/apache/commons/latka/ValidationException.html">ValidationException</a>;
  <a name="64" href="#64">64</a>  
  <a name="65" href="#65">65</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/event/index.html">org.apache.commons.latka.event</a>.<a href="../../../../../org/apache/commons/latka/event/LatkaEventListener.html">LatkaEventListener</a>;
  <a name="66" href="#66">66</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/event/index.html">org.apache.commons.latka.event</a>.<a href="../../../../../org/apache/commons/latka/event/RequestFailedEvent.html">RequestFailedEvent</a>;
  <a name="67" href="#67">67</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a>;
  <a name="68" href="#68">68</a>  
  <a name="69" href="#69">69</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/util/xml/index.html">org.apache.commons.latka.util.xml</a>.<a href="../../../../../org/apache/commons/latka/util/xml/BasicDelegateHandler.html">BasicDelegateHandler</a>;
  <a name="70" href="#70">70</a>  
  <a name="71" href="#71">71</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="72" href="#72">72</a>  <b>import</b> org.xml.sax.SAXParseException;
  <a name="73" href="#73">73</a>  <b>import</b> org.xml.sax.XMLReader;
  <a name="74" href="#74">74</a>  
  <a name="75" href="#75">75</a>  <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="76" href="#76">76</a>  <font color="#AA0000"><i> * A base class for validation tags</font></i>
  <a name="77" href="#77">77</a>  <font color="#AA0000"><i> *</font></i>
  <a name="78" href="#78">78</a>  <font color="#AA0000"><i> * @author Morgan Delagrange</font></i>
  <a name="79" href="#79">79</a>  <font color="#AA0000"><i> * @author dIon Gillard</font></i>
  <a name="80" href="#80">80</a>  <font color="#AA0000"><i> * @version $Id: ValidationHandler.html,v 1.1 2002/04/01 05:46:02 dion Exp $</font></i>
  <a name="81" href="#81">81</a>  <font color="#AA0000"><i> */</font></i>
  <a name="82" href="#82">82</a>  <b>public</b> <b>abstract</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/ValidationHandler.html">ValidationHandler</a> <b>extends</b> <a href="../../../../../org/apache/commons/latka/util/xml/BasicDelegateHandler.html">BasicDelegateHandler</a> {
  <a name="83" href="#83">83</a>  
  <a name="84" href="#84">84</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* the response being validated */</font></i></font></i>
  <a name="85" href="#85">85</a>      <b>private</b> <a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a> _response = <b>null</b>;
  <a name="86" href="#86">86</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* the listener handling request success/failure etc */</font></i></font></i>
  <a name="87" href="#87">87</a>      <b>private</b> <a href="../../../../../org/apache/commons/latka/event/LatkaEventListener.html">LatkaEventListener</a> _listener = <b>null</b>;
  <a name="88" href="#88">88</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* name of the validating tag */</font></i></font></i>
  <a name="89" href="#89">89</a>      <b>private</b> String _tagName = <b>null</b>;
  <a name="90" href="#90">90</a>  
  <a name="91" href="#91">91</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="92" href="#92">92</a>  <font color="#AA0000"><i>     * Called by the ValidationFactory.</font></i>
  <a name="93" href="#93">93</a>  <font color="#AA0000"><i>     *</font></i>
  <a name="94" href="#94">94</a>  <font color="#AA0000"><i>     * @param listener supplier of information about the suite/progress</font></i>
  <a name="95" href="#95">95</a>  <font color="#AA0000"><i>     * @param tagName name of the validating tag</font></i>
  <a name="96" href="#96">96</a>  <font color="#AA0000"><i>     * @param reader xml to process </font></i>
  <a name="97" href="#97">97</a>  <font color="#AA0000"><i>     * @param response response to validate</font></i>
  <a name="98" href="#98">98</a>  <font color="#AA0000"><i>     */</font></i>
  <a name="99" href="#99">99</a>      <b>void</b> init(XMLReader reader, <a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a> response, <a href="../../../../../org/apache/commons/latka/event/LatkaEventListener.html">LatkaEventListener</a> listener,
  <a name="100" href="#100">100</a>               String tagName) {
  <a name="101" href="#101">101</a>         <b>super</b>.init(reader);
  <a name="102" href="#102">102</a>         _response = response;
  <a name="103" href="#103">103</a>         _listener = listener;
  <a name="104" href="#104">104</a>         _tagName = tagName;
  <a name="105" href="#105">105</a>     }
  <a name="106" href="#106">106</a> 
  <a name="107" href="#107">107</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="108" href="#108">108</a> <font color="#AA0000"><i>     * the response being validated</font></i>
  <a name="109" href="#109">109</a> <font color="#AA0000"><i>     * @return the response being validated</font></i>
  <a name="110" href="#110">110</a> <font color="#AA0000"><i>     */</font></i>
  <a name="111" href="#111">111</a>     <b>public</b> <a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a> getResponse() {
  <a name="112" href="#112">112</a>         <b>return</b> _response;
  <a name="113" href="#113">113</a>     }
  <a name="114" href="#114">114</a> 
  <a name="115" href="#115">115</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="116" href="#116">116</a> <font color="#AA0000"><i>     * validate the response using the validator provided</font></i>
  <a name="117" href="#117">117</a> <font color="#AA0000"><i>     * @param validator the object that performs validation</font></i>
  <a name="118" href="#118">118</a> <font color="#AA0000"><i>     */</font></i>
  <a name="119" href="#119">119</a>     <b>public</b> <b>void</b> validate(<a href="../../../../../org/apache/commons/latka/Validator.html">Validator</a> validator) {
  <a name="120" href="#120">120</a>         log.debug(<font color="#000099">"performing custom validation"</font>);
  <a name="121" href="#121">121</a>         log.debug(<font color="#000099">"validator = "</font> + validator);
  <a name="122" href="#122">122</a>         log.debug(<font color="#000099">"response = "</font> + _response);
  <a name="123" href="#123">123</a>         <b>try</b> {
  <a name="124" href="#124">124</a>             validator.validate(_response);
  <a name="125" href="#125">125</a>         } <b>catch</b> (ValidationException e) {
  <a name="126" href="#126">126</a>             _listener.requestFailed(
  <a name="127" href="#127">127</a>                 <b>new</b> <a href="../../../../../org/apache/commons/latka/event/RequestFailedEvent.html">RequestFailedEvent</a>(_response.getRequest(), _response, e));
  <a name="128" href="#128">128</a>         }
  <a name="129" href="#129">129</a> 
  <a name="130" href="#130">130</a>         log.debug(<font color="#000099">"custom validation complete"</font>);
  <a name="131" href="#131">131</a>         release();
  <a name="132" href="#132">132</a>     }
  <a name="133" href="#133">133</a>   
  <a name="134" href="#134">134</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="135" href="#135">135</a> <font color="#AA0000"><i>     * @return  the name of the tag</font></i>
  <a name="136" href="#136">136</a> <font color="#AA0000"><i>     */</font></i>
  <a name="137" href="#137">137</a>     <b>public</b> String getTagName() {
  <a name="138" href="#138">138</a>         <b>return</b> _tagName;
  <a name="139" href="#139">139</a>     }
  <a name="140" href="#140">140</a> 
  <a name="141" href="#141">141</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="142" href="#142">142</a> <font color="#AA0000"><i>     * @param e error that has occurred</font></i>
  <a name="143" href="#143">143</a> <font color="#AA0000"><i>     * @throws SAXException to indicate the error has occurred</font></i>
  <a name="144" href="#144">144</a> <font color="#AA0000"><i>     */</font></i>
  <a name="145" href="#145">145</a>     <b>public</b> <b>void</b> error(SAXParseException e) throws SAXException {
  <a name="146" href="#146">146</a>         <b>throw</b> e;
  <a name="147" href="#147">147</a>     }
  <a name="148" href="#148">148</a> 
  <a name="149" href="#149">149</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="150" href="#150">150</a> <font color="#AA0000"><i>     * @param e error that has occurred</font></i>
  <a name="151" href="#151">151</a> <font color="#AA0000"><i>     * @throws SAXException to indicate the error has occurred</font></i>
  <a name="152" href="#152">152</a> <font color="#AA0000"><i>     */</font></i>
  <a name="153" href="#153">153</a>     <b>public</b> <b>void</b> warning(SAXParseException e) throws SAXException {
  <a name="154" href="#154">154</a>         <b>throw</b> e;
  <a name="155" href="#155">155</a>     }
  <a name="156" href="#156">156</a> 
  <a name="157" href="#157">157</a> }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/SuiteHandler.html
  
  Index: SuiteHandler.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/SuiteHandler.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>   
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> java.util.HashMap;
  <a name="63" href="#63">63</a>  <b>import</b> java.util.Map;
  <a name="64" href="#64">64</a>  <b>import</b> java.util.Properties;
  <a name="65" href="#65">65</a>  
  <a name="66" href="#66">66</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/index.html">org.apache.commons.latka</a>.<a href="../../../../../org/apache/commons/latka/LatkaProperties.html">LatkaProperties</a>;
  <a name="67" href="#67">67</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/event/index.html">org.apache.commons.latka.event</a>.<a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a>;
  <a name="68" href="#68">68</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/event/index.html">org.apache.commons.latka.event</a>.<a href="../../../../../org/apache/commons/latka/event/SuiteCompletedEvent.html">SuiteCompletedEvent</a>;
  <a name="69" href="#69">69</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a>;
  <a name="70" href="#70">70</a>  
  <a name="71" href="#71">71</a>  <b>import</b> org.apache.log4j.Category;
  <a name="72" href="#72">72</a>  
  <a name="73" href="#73">73</a>  <b>import</b> org.xml.sax.Attributes;
  <a name="74" href="#74">74</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="75" href="#75">75</a>  <b>import</b> org.xml.sax.XMLReader;
  <a name="76" href="#76">76</a>  
  <a name="77" href="#77">77</a>  <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="78" href="#78">78</a>  <font color="#AA0000"><i> * Handle the processing of the suite tag</font></i>
  <a name="79" href="#79">79</a>  <font color="#AA0000"><i> *</font></i>
  <a name="80" href="#80">80</a>  <font color="#AA0000"><i> * @author Morgan Delagrange</font></i>
  <a name="81" href="#81">81</a>  <font color="#AA0000"><i> * @author dIon Gillard</font></i>
  <a name="82" href="#82">82</a>  <font color="#AA0000"><i> * @version $Id: SuiteHandler.html,v 1.1 2002/04/01 05:46:02 dion Exp $</font></i>
  <a name="83" href="#83">83</a>  <font color="#AA0000"><i> */</font></i>
  <a name="84" href="#84">84</a>  <b>public</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/SuiteHandler.html">SuiteHandler</a> <b>extends</b> <a href="../../../../../org/apache/commons/latka/xml/LatkaHandler.html">LatkaHandler</a> {
  <a name="85" href="#85">85</a>  
  <a name="86" href="#86">86</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* listener to fire events to */</font></i></font></i>
  <a name="87" href="#87">87</a>      <b>protected</b> <a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a> _listener = <b>null</b>;
  <a name="88" href="#88">88</a>  
  <a name="89" href="#89">89</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* log4j category to append output to */</font></i></font></i>
  <a name="90" href="#90">90</a>      <b>protected</b> <b>static</b> Category _log = 
  <a name="91" href="#91">91</a>          Category.getInstance(SuiteHandler.<b>class</b>);
  <a name="92" href="#92">92</a>  
  <a name="93" href="#93">93</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* FIXME: not really used in this class */</font></i></font></i>
  <a name="94" href="#94">94</a>      <b>protected</b> Map _sessionCache = <b>new</b> HashMap();
  <a name="95" href="#95">95</a>  
  <a name="96" href="#96">96</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="97" href="#97">97</a>  <font color="#AA0000"><i>     * Create a new Suite handler with the given XML data and event listener</font></i>
  <a name="98" href="#98">98</a>  <font color="#AA0000"><i>     * @param reader the source of XML</font></i>
  <a name="99" href="#99">99</a>  <font color="#AA0000"><i>     * @param listener used to notify of completion and other events</font></i>
  <a name="100" href="#100">100</a> <font color="#AA0000"><i>     */</font></i>
  <a name="101" href="#101">101</a>     <b>public</b> <a href="../../../../../org/apache/commons/latka/xml/SuiteHandler.html">SuiteHandler</a>(XMLReader reader, <a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a> listener) {
  <a name="102" href="#102">102</a>         <b>super</b>(reader);
  <a name="103" href="#103">103</a>         _listener = listener;
  <a name="104" href="#104">104</a>         _log.debug(<font color="#000099">"suite handler instantiated"</font>);
  <a name="105" href="#105">105</a>     }
  <a name="106" href="#106">106</a> 
  <a name="107" href="#107">107</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="108" href="#108">108</a> <font color="#AA0000"><i>     * On start of&lt;br /&gt;</font></i>
  <a name="109" href="#109">109</a> <font color="#AA0000"><i>     * suite: store defaultHost and defaultPort attributes as properties &lt;br /&gt;</font></i>
  <a name="110" href="#110">110</a> <font color="#AA0000"><i>     * session: create a session handler and delegate to it &lt;br /&gt;</font></i>
  <a name="111" href="#111">111</a> <font color="#AA0000"><i>     * request: create a new session and a request handler and delegate</font></i>
  <a name="112" href="#112">112</a> <font color="#AA0000"><i>     *</font></i>
  <a name="113" href="#113">113</a> <font color="#AA0000"><i>     * @param uri namespace URI if namespace processing is being done</font></i>
  <a name="114" href="#114">114</a> <font color="#AA0000"><i>     * @param localName The element type name</font></i>
  <a name="115" href="#115">115</a> <font color="#AA0000"><i>     * @param qName fully qualified element name</font></i>
  <a name="116" href="#116">116</a> <font color="#AA0000"><i>     * @param atts The specified or defaulted attributes</font></i>
  <a name="117" href="#117">117</a> <font color="#AA0000"><i>     * @throws SAXException due to interface requirements</font></i>
  <a name="118" href="#118">118</a> <font color="#AA0000"><i>     */</font></i>
  <a name="119" href="#119">119</a>     <b>public</b> <b>void</b> startElement(String uri, String localName, String qName,
  <a name="120" href="#120">120</a>                              Attributes atts) throws SAXException{
  <a name="121" href="#121">121</a> 
  <a name="122" href="#122">122</a>         <b>if</b> (localName.equals(<font color="#000099">"suite"</font>)) {
  <a name="123" href="#123">123</a> 
  <a name="124" href="#124">124</a>             Properties props = LatkaProperties.getProperties();
  <a name="125" href="#125">125</a> 
  <a name="126" href="#126">126</a>             String defaultHost = atts.getValue(<font color="#000099">"defaultHost"</font>);
  <a name="127" href="#127">127</a>             <b>if</b> (defaultHost != <b>null</b>) {
  <a name="128" href="#128">128</a>                 props.setProperty(<font color="#000099">"latka.defaultHost"</font>, defaultHost);
  <a name="129" href="#129">129</a>             } <b>else</b> {
  <a name="130" href="#130">130</a>                 <font color="#329900"><i>// clear this property, so that its value is not</font></i>
  <a name="131" href="#131">131</a>                 <font color="#329900"><i>// leaked from a previous invocation</font></i>
  <a name="132" href="#132">132</a>                 props.remove(<font color="#000099">"latka.defaultHost"</font>);
  <a name="133" href="#133">133</a>             }
  <a name="134" href="#134">134</a> 
  <a name="135" href="#135">135</a>             String portString = atts.getValue(<font color="#000099">"defaultPort"</font>);
  <a name="136" href="#136">136</a>             <b>if</b> (portString != <b>null</b>) {
  <a name="137" href="#137">137</a>                 props.setProperty(<font color="#000099">"latka.defaultPort"</font>, portString);
  <a name="138" href="#138">138</a>             } <b>else</b> {
  <a name="139" href="#139">139</a>                 props.remove(<font color="#000099">"latka.defaultPort"</font>);
  <a name="140" href="#140">140</a>             }
  <a name="141" href="#141">141</a> 
  <a name="142" href="#142">142</a>         } <b>else</b> <b>if</b> (localName.equals(<font color="#000099">"session"</font>)) {
  <a name="143" href="#143">143</a> 
  <a name="144" href="#144">144</a>             <a href="../../../../../org/apache/commons/latka/xml/SessionHandler.html">SessionHandler</a> handler = <b>new</b> <a href="../../../../../org/apache/commons/latka/xml/SessionHandler.html">SessionHandler</a>(_reader, _listener,
  <a name="145" href="#145">145</a>                                                         _sessionCache);
  <a name="146" href="#146">146</a>             handler.delegate(uri, localName, qName, atts);
  <a name="147" href="#147">147</a> 
  <a name="148" href="#148">148</a>         } <b>else</b> <b>if</b> (localName.equals(<font color="#000099">"request"</font>)) {
  <a name="149" href="#149">149</a>             <font color="#329900"><i>// implicit session</font></i>
  <a name="150" href="#150">150</a>             <a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a> session = <b>new</b> <a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a>();
  <a name="151" href="#151">151</a>             <a href="../../../../../org/apache/commons/latka/xml/RequestHandler.html">RequestHandler</a> handler =
  <a name="152" href="#152">152</a>                 <b>new</b> <a href="../../../../../org/apache/commons/latka/xml/RequestHandler.html">RequestHandler</a>(_reader, session, _listener);
  <a name="153" href="#153">153</a>             handler.delegate(uri, localName, qName, atts);
  <a name="154" href="#154">154</a>         }
  <a name="155" href="#155">155</a>     }
  <a name="156" href="#156">156</a> 
  <a name="157" href="#157">157</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="158" href="#158">158</a> <font color="#AA0000"><i>     * fire suiteCompleted to the listener when the suite tag end is reached</font></i>
  <a name="159" href="#159">159</a> <font color="#AA0000"><i>     * @param namespaceURI - The Namespace URI, or the empty string if the</font></i>
  <a name="160" href="#160">160</a> <font color="#AA0000"><i>     *      element has no Namespace URI or if Namespace processing is not </font></i>
  <a name="161" href="#161">161</a> <font color="#AA0000"><i>     *      being performed</font></i>
  <a name="162" href="#162">162</a> <font color="#AA0000"><i>     * @param localName - The local name (without prefix), or the empty string</font></i>
  <a name="163" href="#163">163</a> <font color="#AA0000"><i>     *      if Namespace processing is not being performed</font></i>
  <a name="164" href="#164">164</a> <font color="#AA0000"><i>     * @param rawName - The qualified XML 1.0 name (with prefix), or the empty</font></i>
  <a name="165" href="#165">165</a> <font color="#AA0000"><i>     *      string if qualified names are not available</font></i>
  <a name="166" href="#166">166</a> <font color="#AA0000"><i>     * @throws SAXException when errors occur</font></i>
  <a name="167" href="#167">167</a> <font color="#AA0000"><i>     */</font></i>
  <a name="168" href="#168">168</a>     <b>public</b> <b>void</b> endElement(String namespaceURI, String localName,
  <a name="169" href="#169">169</a>                            String rawName) throws SAXException {
  <a name="170" href="#170">170</a>         <b>if</b> (localName.equals(<font color="#000099">"suite"</font>)) {
  <a name="171" href="#171">171</a>             _listener.suiteCompleted(<b>new</b> <a href="../../../../../org/apache/commons/latka/event/SuiteCompletedEvent.html">SuiteCompletedEvent</a>());
  <a name="172" href="#172">172</a>         }
  <a name="173" href="#173">173</a>     }
  <a name="174" href="#174">174</a> 
  <a name="175" href="#175">175</a> }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/SessionHandler.html
  
  Index: SessionHandler.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/SessionHandler.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights</font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer.</font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:</font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the</font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written</font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> java.util.Map;
  <a name="63" href="#63">63</a>  
  <a name="64" href="#64">64</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/event/index.html">org.apache.commons.latka.event</a>.<a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a>;
  <a name="65" href="#65">65</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a>;
  <a name="66" href="#66">66</a>  
  <a name="67" href="#67">67</a>  <b>import</b> org.apache.log4j.Category;
  <a name="68" href="#68">68</a>  
  <a name="69" href="#69">69</a>  <b>import</b> org.xml.sax.Attributes;
  <a name="70" href="#70">70</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="71" href="#71">71</a>  <b>import</b> org.xml.sax.XMLReader;
  <a name="72" href="#72">72</a>  
  <a name="73" href="#73">73</a>  <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="74" href="#74">74</a>  <font color="#AA0000"><i> * FIXME: Needs docs</font></i>
  <a name="75" href="#75">75</a>  <font color="#AA0000"><i> *</font></i>
  <a name="76" href="#76">76</a>  <font color="#AA0000"><i> * @author Morgan Delagrange</font></i>
  <a name="77" href="#77">77</a>  <font color="#AA0000"><i> * @author dIon Gillard</font></i>
  <a name="78" href="#78">78</a>  <font color="#AA0000"><i> * @version $Id: SessionHandler.html,v 1.1 2002/04/01 05:46:02 dion Exp $</font></i>
  <a name="79" href="#79">79</a>  <font color="#AA0000"><i> */</font></i>
  <a name="80" href="#80">80</a>  <b>public</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/SessionHandler.html">SessionHandler</a> <b>extends</b> <a href="../../../../../org/apache/commons/latka/xml/LatkaHandler.html">LatkaHandler</a> {
  <a name="81" href="#81">81</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* listener to receive events as they occurr*/</font></i></font></i>
  <a name="82" href="#82">82</a>      <b>protected</b> <a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a> _listener = <b>null</b>;
  <a name="83" href="#83">83</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* the http session*/</font></i></font></i>
  <a name="84" href="#84">84</a>      <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a> _session = <b>null</b>;
  <a name="85" href="#85">85</a>      
  <a name="86" href="#86">86</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* session cache */</font></i></font></i>
  <a name="87" href="#87">87</a>      <b>protected</b> Map _sessionCache = <b>null</b>;
  <a name="88" href="#88">88</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>* log4j category to append data to */</font></i></font></i>
  <a name="89" href="#89">89</a>      <b>protected</b> <b>static</b> Category _log = Category.getInstance(SessionHandler.<b>class</b>);
  <a name="90" href="#90">90</a>      
  <a name="91" href="#91">91</a>      <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="92" href="#92">92</a>  <font color="#AA0000"><i>     * @param reader source of XML data</font></i>
  <a name="93" href="#93">93</a>  <font color="#AA0000"><i>     * @param listener to broadcast events to</font></i>
  <a name="94" href="#94">94</a>  <font color="#AA0000"><i>     * @param sessionCache sessions shared between handlers</font></i>
  <a name="95" href="#95">95</a>  <font color="#AA0000"><i>     */</font></i>
  <a name="96" href="#96">96</a>      <b>public</b> <a href="../../../../../org/apache/commons/latka/xml/SessionHandler.html">SessionHandler</a>(XMLReader reader, <a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a> listener,
  <a name="97" href="#97">97</a>                             Map sessionCache) {
  <a name="98" href="#98">98</a>          <b>super</b>(reader);
  <a name="99" href="#99">99</a>          _listener = listener;
  <a name="100" href="#100">100</a>         <font color="#329900"><i>// the suite handler class is responsible for storing</font></i>
  <a name="101" href="#101">101</a>         <font color="#329900"><i>// the session cache</font></i>
  <a name="102" href="#102">102</a>         _sessionCache = sessionCache;
  <a name="103" href="#103">103</a>         log.debug(<font color="#000099">"session handler instantiated"</font>);
  <a name="104" href="#104">104</a>     }
  <a name="105" href="#105">105</a>     
  <a name="106" href="#106">106</a>     <b>public</b> <b>void</b> startElement(String uri, String localName, String qName,
  <a name="107" href="#107">107</a>                              Attributes atts) throws SAXException {
  <a name="108" href="#108">108</a>         <b>if</b> (localName.equals(<font color="#000099">"session"</font>)) {
  <a name="109" href="#109">109</a>             _session = generateSession(atts);
  <a name="110" href="#110">110</a>         } <b>else</b> <b>if</b> (localName.equals(<font color="#000099">"request"</font>)) {
  <a name="111" href="#111">111</a>             <a href="../../../../../org/apache/commons/latka/xml/RequestHandler.html">RequestHandler</a> handler = <b>null</b>;
  <a name="112" href="#112">112</a>             <b>if</b> (_listener.didSessionSucceed(_session) == false) {
  <a name="113" href="#113">113</a>                 handler = <b>new</b> <a href="../../../../../org/apache/commons/latka/xml/RequestHandler.html">RequestHandler</a>(_reader, _session, _listener, <b>true</b>);
  <a name="114" href="#114">114</a>             } <b>else</b> {
  <a name="115" href="#115">115</a>                 handler = <b>new</b> <a href="../../../../../org/apache/commons/latka/xml/RequestHandler.html">RequestHandler</a>(_reader, _session, _listener);
  <a name="116" href="#116">116</a>             }
  <a name="117" href="#117">117</a>             handler.delegate(uri, localName, qName, atts);
  <a name="118" href="#118">118</a>         }
  <a name="119" href="#119">119</a>     }
  <a name="120" href="#120">120</a>     
  <a name="121" href="#121">121</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="122" href="#122">122</a> <font color="#AA0000"><i>     * Process an end session tag by releasing resources</font></i>
  <a name="123" href="#123">123</a> <font color="#AA0000"><i>     * @param namespaceURI - The Namespace URI, or the empty string if the</font></i>
  <a name="124" href="#124">124</a> <font color="#AA0000"><i>     *      element has no Namespace URI or if Namespace processing is not </font></i>
  <a name="125" href="#125">125</a> <font color="#AA0000"><i>     *      being performed</font></i>
  <a name="126" href="#126">126</a> <font color="#AA0000"><i>     * @param localName - The local name (without prefix), or the empty string</font></i>
  <a name="127" href="#127">127</a> <font color="#AA0000"><i>     *      if Namespace processing is not being performed</font></i>
  <a name="128" href="#128">128</a> <font color="#AA0000"><i>     * @param rawName - The qualified XML 1.0 name (with prefix), or the empty</font></i>
  <a name="129" href="#129">129</a> <font color="#AA0000"><i>     *      string if qualified names are not available</font></i>
  <a name="130" href="#130">130</a> <font color="#AA0000"><i>     */</font></i>
  <a name="131" href="#131">131</a>     <b>public</b> <b>void</b> endElement(String namespaceURI, String localName, 
  <a name="132" href="#132">132</a>                            String rawName) {
  <a name="133" href="#133">133</a>         <b>if</b> (localName.equals(<font color="#000099">"session"</font>)) {
  <a name="134" href="#134">134</a>             release();
  <a name="135" href="#135">135</a>         }
  <a name="136" href="#136">136</a>     }
  <a name="137" href="#137">137</a>     
  <a name="138" href="#138">138</a>     
  <a name="139" href="#139">139</a>     <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="140" href="#140">140</a> <font color="#AA0000"><i>     * Checks the session_id and returns a cached SessionImpl</font></i>
  <a name="141" href="#141">141</a> <font color="#AA0000"><i>     * if the id has been used previously</font></i>
  <a name="142" href="#142">142</a> <font color="#AA0000"><i>     *</font></i>
  <a name="143" href="#143">143</a> <font color="#AA0000"><i>     * @param atts   Attributes of the "session" element</font></i>
  <a name="144" href="#144">144</a> <font color="#AA0000"><i>     * @return A SessionImpl object</font></i>
  <a name="145" href="#145">145</a> <font color="#AA0000"><i>     */</font></i>
  <a name="146" href="#146">146</a>     <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a> generateSession(Attributes atts) {
  <a name="147" href="#147">147</a>         
  <a name="148" href="#148">148</a>         String sessionId = atts.getValue(<font color="#000099">"sessionId"</font>);
  <a name="149" href="#149">149</a>         <b>if</b> (sessionId == <b>null</b>) {
  <a name="150" href="#150">150</a>             _log.debug(<font color="#000099">"generating new session with no session id"</font>);
  <a name="151" href="#151">151</a>             <b>return</b> <b>new</b> <a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a>();
  <a name="152" href="#152">152</a>         }
  <a name="153" href="#153">153</a>         
  <a name="154" href="#154">154</a>         <a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a> cachedSession = (SessionImpl) _sessionCache.get(sessionId);
  <a name="155" href="#155">155</a>         <b>if</b> (cachedSession != <b>null</b>) {
  <a name="156" href="#156">156</a>             _log.debug(<font color="#000099">"returning cached session: "</font> + sessionId);
  <a name="157" href="#157">157</a>             <b>return</b> cachedSession;
  <a name="158" href="#158">158</a>         }
  <a name="159" href="#159">159</a>         
  <a name="160" href="#160">160</a>         <a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a> session = <b>new</b> <a href="../../../../../org/apache/commons/latka/http/SessionImpl.html">SessionImpl</a>();
  <a name="161" href="#161">161</a>         _log.debug(<font color="#000099">"generating new session with id: "</font> + sessionId);
  <a name="162" href="#162">162</a>         _sessionCache.put(sessionId, session);
  <a name="163" href="#163">163</a>         <b>return</b> session;
  <a name="164" href="#164">164</a>     }
  <a name="165" href="#165">165</a>     
  <a name="166" href="#166">166</a> }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/RequestHeaderHandler.html
  
  Index: RequestHeaderHandler.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/RequestHeaderHandler.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>   
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a>;
  <a name="63" href="#63">63</a>  
  <a name="64" href="#64">64</a>  <b>import</b> org.apache.log4j.Category;
  <a name="65" href="#65">65</a>  
  <a name="66" href="#66">66</a>  
  <a name="67" href="#67">67</a>  <b>import</b> org.xml.sax.Attributes;
  <a name="68" href="#68">68</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="69" href="#69">69</a>  <b>import</b> org.xml.sax.XMLReader;
  <a name="70" href="#70">70</a>  
  <a name="71" href="#71">71</a>  <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="72" href="#72">72</a>  <font color="#AA0000"><i> * @author Morgan Delagrange</font></i>
  <a name="73" href="#73">73</a>  <font color="#AA0000"><i> * @author dIon Gillard</font></i>
  <a name="74" href="#74">74</a>  <font color="#AA0000"><i> * @version $Id: RequestHeaderHandler.html,v 1.1 2002/04/01 05:46:02 dion Exp $</font></i>
  <a name="75" href="#75">75</a>  <font color="#AA0000"><i> */</font></i>
  <a name="76" href="#76">76</a>  <b>public</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/RequestHeaderHandler.html">RequestHeaderHandler</a> <b>extends</b> <a href="../../../../../org/apache/commons/latka/xml/LatkaHandler.html">LatkaHandler</a> {
  <a name="77" href="#77">77</a>  
  <a name="78" href="#78">78</a>    <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a> _request = <b>null</b>;
  <a name="79" href="#79">79</a>  
  <a name="80" href="#80">80</a>    <b>protected</b> <b>static</b> <b>final</b> Category log = Category.getInstance(RequestHeaderHandler.<b>class</b>);
  <a name="81" href="#81">81</a>  
  <a name="82" href="#82">82</a>    <b>public</b> <a href="../../../../../org/apache/commons/latka/xml/RequestHeaderHandler.html">RequestHeaderHandler</a>(XMLReader reader,
  <a name="83" href="#83">83</a>                            <a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a> request) {
  <a name="84" href="#84">84</a>      <b>super</b>(reader);
  <a name="85" href="#85">85</a>      _request = request;
  <a name="86" href="#86">86</a>    }
  <a name="87" href="#87">87</a>  
  <a name="88" href="#88">88</a>    <b>public</b> <b>void</b> startElement(String uri, String localName, 
  <a name="89" href="#89">89</a>                             String qName, Attributes atts) 
  <a name="90" href="#90">90</a>    throws SAXException {
  <a name="91" href="#91">91</a>  
  <a name="92" href="#92">92</a>      log.info(<font color="#000099">"request header received"</font>);
  <a name="93" href="#93">93</a>  
  <a name="94" href="#94">94</a>      <b>if</b> (localName.equals(<font color="#000099">"requestHeader"</font>)) {
  <a name="95" href="#95">95</a>        log.info(<font color="#000099">"adding header"</font>);
  <a name="96" href="#96">96</a>        _request.addHeader(atts.getValue(<font color="#000099">"headerName"</font>),
  <a name="97" href="#97">97</a>                           atts.getValue(<font color="#000099">"headerValue"</font>));
  <a name="98" href="#98">98</a>      } <b>else</b> {
  <a name="99" href="#99">99</a>        <font color="#329900"><i>// release as soon as all the headers are processed</font></i>
  <a name="100" href="#100">100</a>       release(uri, localName, qName, atts);
  <a name="101" href="#101">101</a>     }
  <a name="102" href="#102">102</a> 
  <a name="103" href="#103">103</a>   }
  <a name="104" href="#104">104</a> 
  <a name="105" href="#105">105</a>   <b>public</b> <b>void</b> endElement(String namespaceURI, String localName, 
  <a name="106" href="#106">106</a>                          String rawName) throws SAXException {
  <a name="107" href="#107">107</a> 
  <a name="108" href="#108">108</a>     <b>if</b> (!localName.equals(<font color="#000099">"requestHeader"</font>)) {
  <a name="109" href="#109">109</a>       release(namespaceURI, localName, rawName);
  <a name="110" href="#110">110</a>     }
  <a name="111" href="#111">111</a> 
  <a name="112" href="#112">112</a>   }
  <a name="113" href="#113">113</a> }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/RequestHandler.html
  
  Index: RequestHandler.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/RequestHandler.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>   
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> java.io.IOException;
  <a name="63" href="#63">63</a>  
  <a name="64" href="#64">64</a>  <b>import</b> java.net.MalformedURLException;
  <a name="65" href="#65">65</a>  <b>import</b> java.net.URL;
  <a name="66" href="#66">66</a>  
  <a name="67" href="#67">67</a>  <b>import</b> java.util.LinkedList;
  <a name="68" href="#68">68</a>  <b>import</b> java.util.List;
  <a name="69" href="#69">69</a>  <b>import</b> java.util.Properties;
  <a name="70" href="#70">70</a>  
  <a name="71" href="#71">71</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/index.html">org.apache.commons.latka</a>.<a href="../../../../../org/apache/commons/latka/LatkaProperties.html">LatkaProperties</a>;
  <a name="72" href="#72">72</a>  
  <a name="73" href="#73">73</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/event/index.html">org.apache.commons.latka.event</a>.*;
  <a name="74" href="#74">74</a>  
  <a name="75" href="#75">75</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/Credentials.html">Credentials</a>;
  <a name="76" href="#76">76</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/CredentialsImpl.html">CredentialsImpl</a>;
  <a name="77" href="#77">77</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a>;
  <a name="78" href="#78">78</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a>;
  <a name="79" href="#79">79</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/Session.html">Session</a>;
  <a name="80" href="#80">80</a>  
  <a name="81" href="#81">81</a>  <b>import</b> org.apache.log4j.Category;
  <a name="82" href="#82">82</a>  
  <a name="83" href="#83">83</a>  <b>import</b> org.xml.sax.Attributes;
  <a name="84" href="#84">84</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="85" href="#85">85</a>  <b>import</b> org.xml.sax.XMLReader;
  <a name="86" href="#86">86</a>  
  <a name="87" href="#87">87</a>  <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="88" href="#88">88</a>  <font color="#AA0000"><i> * FIXME: Needs docs</font></i>
  <a name="89" href="#89">89</a>  <font color="#AA0000"><i> * </font></i>
  <a name="90" href="#90">90</a>  <font color="#AA0000"><i> * @author Morgan Delagrange</font></i>
  <a name="91" href="#91">91</a>  <font color="#AA0000"><i> * @author dIon Gillard</font></i>
  <a name="92" href="#92">92</a>  <font color="#AA0000"><i> * @version $Id: RequestHandler.html,v 1.1 2002/04/01 05:46:02 dion Exp $</font></i>
  <a name="93" href="#93">93</a>  <font color="#AA0000"><i> */</font></i>
  <a name="94" href="#94">94</a>  <b>public</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/RequestHandler.html">RequestHandler</a> <b>extends</b> <a href="../../../../../org/apache/commons/latka/xml/LatkaHandler.html">LatkaHandler</a> {
  <a name="95" href="#95">95</a>    <b>protected</b> <a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a> _listener = <b>null</b>;
  <a name="96" href="#96">96</a>  
  <a name="97" href="#97">97</a>    <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Session.html">Session</a> _session = <b>null</b>;
  <a name="98" href="#98">98</a>    <b>protected</b> String _defaultHost = <b>null</b>;
  <a name="99" href="#99">99</a>    <b>protected</b> <b>int</b> _defaultPort = -1;
  <a name="100" href="#100">100</a> 
  <a name="101" href="#101">101</a>   <b>protected</b> <b>boolean</b> _skipped = false;
  <a name="102" href="#102">102</a> 
  <a name="103" href="#103">103</a>   <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a>  _request = <b>null</b>;
  <a name="104" href="#104">104</a>   <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a> _response = <b>null</b>;
  <a name="105" href="#105">105</a>   <b>protected</b> <b>boolean</b>  _requestExecuted = false;
  <a name="106" href="#106">106</a>   <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Credentials.html">Credentials</a> _credentials = <b>null</b>;
  <a name="107" href="#107">107</a> 
  <a name="108" href="#108">108</a>   <b>protected</b> List _visitedURLs = <b>new</b> LinkedList();
  <a name="109" href="#109">109</a> 
  <a name="110" href="#110">110</a>   <b>protected</b> <b>static</b> <b>final</b> Category _log = 
  <a name="111" href="#111">111</a>   Category.getInstance(RequestHandler.<b>class</b>);
  <a name="112" href="#112">112</a> 
  <a name="113" href="#113">113</a>   <b>public</b> <a href="../../../../../org/apache/commons/latka/xml/RequestHandler.html">RequestHandler</a>(XMLReader reader, <a href="../../../../../org/apache/commons/latka/http/Session.html">Session</a> session,
  <a name="114" href="#114">114</a>                         <a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a> listener)
  <a name="115" href="#115">115</a>   {
  <a name="116" href="#116">116</a>     <b>super</b>(reader);
  <a name="117" href="#117">117</a>     _session = session;
  <a name="118" href="#118">118</a>     _listener = listener;
  <a name="119" href="#119">119</a>     _skipped = false;
  <a name="120" href="#120">120</a>     
  <a name="121" href="#121">121</a>     Properties props = LatkaProperties.getProperties();
  <a name="122" href="#122">122</a>     _defaultHost = props.getProperty(<font color="#000099">"latka.defaultHost"</font>);
  <a name="123" href="#123">123</a>     String portString = props.getProperty(<font color="#000099">"latka.defaultPort"</font>);
  <a name="124" href="#124">124</a>     <b>if</b> (portString != <b>null</b>) {
  <a name="125" href="#125">125</a>       _defaultPort = Integer.parseInt(portString);
  <a name="126" href="#126">126</a>     }
  <a name="127" href="#127">127</a> 
  <a name="128" href="#128">128</a>     _log.debug(<font color="#000099">"request handler instantiated"</font>);
  <a name="129" href="#129">129</a>   }
  <a name="130" href="#130">130</a> 
  <a name="131" href="#131">131</a>   <b>public</b> <a href="../../../../../org/apache/commons/latka/xml/RequestHandler.html">RequestHandler</a>(XMLReader reader,
  <a name="132" href="#132">132</a>                         <a href="../../../../../org/apache/commons/latka/http/Session.html">Session</a> session,
  <a name="133" href="#133">133</a>                         <a href="../../../../../org/apache/commons/latka/event/LatkaEventInfo.html">LatkaEventInfo</a> listener,
  <a name="134" href="#134">134</a>                         <b>boolean</b> skip)
  <a name="135" href="#135">135</a>   {
  <a name="136" href="#136">136</a>     <b>this</b>(reader, session, listener);
  <a name="137" href="#137">137</a>     _skipped = skip;
  <a name="138" href="#138">138</a>   }
  <a name="139" href="#139">139</a> 
  <a name="140" href="#140">140</a>   <b>public</b> <b>void</b> startElement(String uri, String localName,
  <a name="141" href="#141">141</a>                            String qName, Attributes atts)
  <a name="142" href="#142">142</a>   throws SAXException {
  <a name="143" href="#143">143</a> 
  <a name="144" href="#144">144</a>     _log.debug(<font color="#000099">"received start element event"</font>);
  <a name="145" href="#145">145</a> 
  <a name="146" href="#146">146</a>     <b>if</b> (_listener.didRequestSucceed(_request) == false) {
  <a name="147" href="#147">147</a>       <font color="#329900"><i>// if a test in this request has already failed,</font></i>
  <a name="148" href="#148">148</a>       <font color="#329900"><i>// do nothing</font></i>
  <a name="149" href="#149">149</a>       <b>return</b>;
  <a name="150" href="#150">150</a>     }
  <a name="151" href="#151">151</a> 
  <a name="152" href="#152">152</a>     <b>if</b> (localName.equals(<font color="#000099">"request"</font>)) {
  <a name="153" href="#153">153</a>       
  <a name="154" href="#154">154</a>       <b>try</b> {
  <a name="155" href="#155">155</a>         _request = buildRequest(atts);
  <a name="156" href="#156">156</a>       } <b>catch</b> (MalformedURLException e) {
  <a name="157" href="#157">157</a>         <font color="#329900"><i>// error out completely for malformed URLs</font></i>
  <a name="158" href="#158">158</a>         <b>throw</b> <b>new</b> SAXException(e);
  <a name="159" href="#159">159</a>       }
  <a name="160" href="#160">160</a> 
  <a name="161" href="#161">161</a>       <b>if</b> (_skipped) {
  <a name="162" href="#162">162</a>         _listener.requestSkipped(<b>new</b> <a href="../../../../../org/apache/commons/latka/event/RequestSkippedEvent.html">RequestSkippedEvent</a>(_request, <b>null</b>));
  <a name="163" href="#163">163</a>         _log.info(<font color="#000099">"request skipped"</font>);
  <a name="164" href="#164">164</a>       }
  <a name="165" href="#165">165</a>     } <b>else</b> <b>if</b> (localName.equals(<font color="#000099">"credentials"</font>)) {
  <a name="166" href="#166">166</a>       _credentials = <b>new</b> <a href="../../../../../org/apache/commons/latka/http/CredentialsImpl.html">CredentialsImpl</a>(atts.getValue(<font color="#000099">"userName"</font>),
  <a name="167" href="#167">167</a>                                          atts.getValue(<font color="#000099">"password"</font>));
  <a name="168" href="#168">168</a>       _request.setCredentials(_credentials);
  <a name="169" href="#169">169</a>     } <b>else</b> <b>if</b> (localName.equals(<font color="#000099">"requestHeader"</font>)) {  
  <a name="170" href="#170">170</a>       _log.info(<font color="#000099">"adding request headers"</font>);
  <a name="171" href="#171">171</a>       <a href="../../../../../org/apache/commons/latka/xml/RequestHeaderHandler.html">RequestHeaderHandler</a> headerHandler  = <b>new</b> RequestHeaderHandler(_reader,
  <a name="172" href="#172">172</a>                                                                      _request);
  <a name="173" href="#173">173</a>       headerHandler.delegate(uri, localName, qName, atts);
  <a name="174" href="#174">174</a>     } <b>else</b> <b>if</b> (localName.equals(<font color="#000099">"param"</font>)) {
  <a name="175" href="#175">175</a>       _log.info(<font color="#000099">"adding parameters: params should follow"</font>);
  <a name="176" href="#176">176</a>       <a href="../../../../../org/apache/commons/latka/xml/ParameterHandler.html">ParameterHandler</a> paramHandler = <b>new</b> <a href="../../../../../org/apache/commons/latka/xml/ParameterHandler.html">ParameterHandler</a>(_reader,_request);
  <a name="177" href="#177">177</a>       paramHandler.delegate(uri, localName, qName, atts);
  <a name="178" href="#178">178</a>       <b>return</b>;
  <a name="179" href="#179">179</a>     } <b>else</b> <b>if</b> (localName.equals(<font color="#000099">"validate"</font>)) {
  <a name="180" href="#180">180</a> 
  <a name="181" href="#181">181</a>       _log.info(<font color="#000099">"encountered validations"</font>);
  <a name="182" href="#182">182</a> 
  <a name="183" href="#183">183</a>       <b>if</b> (!_skipped) {
  <a name="184" href="#184">184</a>         <b>try</b> {
  <a name="185" href="#185">185</a>           _response = executeRequest();
  <a name="186" href="#186">186</a>           _log.debug(<font color="#000099">"request executed and response obtained"</font>);
  <a name="187" href="#187">187</a>           <a href="../../../../../org/apache/commons/latka/xml/ValidationReflectionHandler.html">ValidationReflectionHandler</a> handler = 
  <a name="188" href="#188">188</a>             <b>new</b> <a href="../../../../../org/apache/commons/latka/xml/ValidationReflectionHandler.html">ValidationReflectionHandler</a>(_reader, _response, _listener);
  <a name="189" href="#189">189</a>           handler.delegate(uri, localName, qName, atts);
  <a name="190" href="#190">190</a>         } <b>catch</b> (IOException e) {
  <a name="191" href="#191">191</a>           _listener.requestError(<b>new</b> <a href="../../../../../org/apache/commons/latka/event/RequestErrorEvent.html">RequestErrorEvent</a>(_request, _response, e));
  <a name="192" href="#192">192</a>         }
  <a name="193" href="#193">193</a>         _requestExecuted = <b>true</b>;
  <a name="194" href="#194">194</a>       }
  <a name="195" href="#195">195</a> 
  <a name="196" href="#196">196</a>     } 
  <a name="197" href="#197">197</a> 
  <a name="198" href="#198">198</a>   }
  <a name="199" href="#199">199</a> 
  <a name="200" href="#200">200</a>   <b>public</b> <b>void</b> endElement(String namespaceURI, String localName,
  <a name="201" href="#201">201</a>                          String rawName) 
  <a name="202" href="#202">202</a>   throws SAXException {
  <a name="203" href="#203">203</a>     <b>if</b> (localName.equals(<font color="#000099">"request"</font>)) {
  <a name="204" href="#204">204</a>       <b>if</b> (_requestExecuted == false && !_skipped) {
  <a name="205" href="#205">205</a>         <b>try</b> {
  <a name="206" href="#206">206</a>           executeRequest();
  <a name="207" href="#207">207</a>           _listener.requestSucceeded(<b>new</b> <a href="../../../../../org/apache/commons/latka/event/RequestSucceededEvent.html">RequestSucceededEvent</a>(_request,
  <a name="208" href="#208">208</a>                                                                _response));
  <a name="209" href="#209">209</a>         } <b>catch</b> (IOException e) {
  <a name="210" href="#210">210</a>           _listener.requestError(<b>new</b> <a href="../../../../../org/apache/commons/latka/event/RequestErrorEvent.html">RequestErrorEvent</a>(_request, _response, e));
  <a name="211" href="#211">211</a>         }
  <a name="212" href="#212">212</a>       } <b>else</b> <b>if</b> (_listener.didRequestSucceed(_request) == <b>true</b>) {
  <a name="213" href="#213">213</a>         <font color="#329900"><i>// broadcast official notification of success</font></i>
  <a name="214" href="#214">214</a>         _listener.requestSucceeded(<b>new</b> <a href="../../../../../org/apache/commons/latka/event/RequestSucceededEvent.html">RequestSucceededEvent</a>(_request,
  <a name="215" href="#215">215</a>                                                              _response));
  <a name="216" href="#216">216</a>       }
  <a name="217" href="#217">217</a> 
  <a name="218" href="#218">218</a>       release();
  <a name="219" href="#219">219</a>     }
  <a name="220" href="#220">220</a>   }
  <a name="221" href="#221">221</a> 
  <a name="222" href="#222">222</a> 
  <a name="223" href="#223">223</a>   <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="224" href="#224">224</a> <font color="#AA0000"><i>   * Executes the request.  In the event of a 301 or 302,</font></i>
  <a name="225" href="#225">225</a> <font color="#AA0000"><i>   * this method may reassign the _request variable to</font></i>
  <a name="226" href="#226">226</a> <font color="#AA0000"><i>   * a different value.</font></i>
  <a name="227" href="#227">227</a> <font color="#AA0000"><i>   */</font></i>
  <a name="228" href="#228">228</a>   <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a> executeRequest() throws IOException {
  <a name="229" href="#229">229</a>     <a href="../../../../../org/apache/commons/latka/http/Response.html">Response</a> response = _request.execute();
  <a name="230" href="#230">230</a> 
  <a name="231" href="#231">231</a>     <b>if</b> (_request.followRedirects() == false) {
  <a name="232" href="#232">232</a>       <b>return</b> response;
  <a name="233" href="#233">233</a>     }
  <a name="234" href="#234">234</a> 
  <a name="235" href="#235">235</a>     <font color="#329900"><i>// execute the request until either we get a non-redirect response, or</font></i>
  <a name="236" href="#236">236</a>     <font color="#329900"><i>// we visit a URL we have already visited</font></i>
  <a name="237" href="#237">237</a>     <b>while</b> (response.getStatusCode() == 301 || response.getStatusCode() == 302) {
  <a name="238" href="#238">238</a>       <font color="#329900"><i>// follow the redirect</font></i>
  <a name="239" href="#239">239</a>       URL url = <b>new</b> URL(response.getHeader(<font color="#000099">"location"</font>));
  <a name="240" href="#240">240</a> 
  <a name="241" href="#241">241</a>       <b>if</b> (_visitedURLs.contains(url.toString())) {
  <a name="242" href="#242">242</a>         <b>return</b> response;
  <a name="243" href="#243">243</a>       }
  <a name="244" href="#244">244</a> 
  <a name="245" href="#245">245</a>       <a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a> request = _session.createRequest(_request.getLabel(),
  <a name="246" href="#246">246</a>                                                url,
  <a name="247" href="#247">247</a>                                                _request.getMethod(),
  <a name="248" href="#248">248</a>                                                <b>true</b>);
  <a name="249" href="#249">249</a>       request.setParameters(_request.getParameters());
  <a name="250" href="#250">250</a>       request.setHeaders(_request.getHeaders());
  <a name="251" href="#251">251</a>       <b>if</b> (_credentials != <b>null</b>) {
  <a name="252" href="#252">252</a>         request.setCredentials(_credentials);
  <a name="253" href="#253">253</a>       }
  <a name="254" href="#254">254</a>       _request = request;
  <a name="255" href="#255">255</a>       response = _request.execute();
  <a name="256" href="#256">256</a>       _visitedURLs.add(url.toString());
  <a name="257" href="#257">257</a>     }
  <a name="258" href="#258">258</a> 
  <a name="259" href="#259">259</a>     <b>return</b> response;
  <a name="260" href="#260">260</a>   }
  <a name="261" href="#261">261</a> 
  <a name="262" href="#262">262</a>   <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a> buildRequest(Attributes atts)
  <a name="263" href="#263">263</a>   throws MalformedURLException {
  <a name="264" href="#264">264</a> 
  <a name="265" href="#265">265</a>     String host = atts.getValue(<font color="#000099">"host"</font>);
  <a name="266" href="#266">266</a>     <b>if</b> (host == <b>null</b>) {
  <a name="267" href="#267">267</a>       host = _defaultHost;
  <a name="268" href="#268">268</a>     }
  <a name="269" href="#269">269</a> 
  <a name="270" href="#270">270</a>     String path   = atts.getValue(<font color="#000099">"path"</font>);
  <a name="271" href="#271">271</a> 
  <a name="272" href="#272">272</a>     <b>boolean</b> secure = false;
  <a name="273" href="#273">273</a>     String secureStr = atts.getValue(<font color="#000099">"secure"</font>);
  <a name="274" href="#274">274</a>     <b>if</b> (<b>null</b> == secureStr) {
  <a name="275" href="#275">275</a>       secure = false;
  <a name="276" href="#276">276</a>     } <b>else</b> <b>if</b> (<font color="#000099">"true"</font>.equalsIgnoreCase(secureStr)) {
  <a name="277" href="#277">277</a>       secure = <b>true</b>;
  <a name="278" href="#278">278</a>     } <b>else</b> {
  <a name="279" href="#279">279</a>       secure = false;
  <a name="280" href="#280">280</a>     }
  <a name="281" href="#281">281</a> 
  <a name="282" href="#282">282</a>     String portString = atts.getValue(<font color="#000099">"port"</font>);
  <a name="283" href="#283">283</a>     <b>int</b> port = _defaultPort;
  <a name="284" href="#284">284</a>     <b>if</b> (portString != <b>null</b>) {
  <a name="285" href="#285">285</a>       port = Integer.parseInt(portString);
  <a name="286" href="#286">286</a>     }
  <a name="287" href="#287">287</a> 
  <a name="288" href="#288">288</a> 
  <a name="289" href="#289">289</a>     URL url = <b>new</b> URL(secure ? <font color="#000099">"https"</font> : <font color="#000099">"http"</font>, host, port, path);
  <a name="290" href="#290">290</a> 
  <a name="291" href="#291">291</a>     String methodString = atts.getValue(<font color="#000099">"method"</font>);
  <a name="292" href="#292">292</a>     <b>int</b> method = -1;
  <a name="293" href="#293">293</a>     <b>if</b> (methodString == <b>null</b>) {
  <a name="294" href="#294">294</a>       method = Request.HTTP_METHOD_GET;
  <a name="295" href="#295">295</a>     } <b>else</b> <b>if</b> (methodString.equalsIgnoreCase(<font color="#000099">"post"</font>)) {
  <a name="296" href="#296">296</a>       method = Request.HTTP_METHOD_POST;
  <a name="297" href="#297">297</a>     } <b>else</b> <b>if</b> (methodString.equalsIgnoreCase(<font color="#000099">"head"</font>)) {
  <a name="298" href="#298">298</a>       method = Request.HTTP_METHOD_HEAD;
  <a name="299" href="#299">299</a>     } <b>else</b> {
  <a name="300" href="#300">300</a>       method = Request.HTTP_METHOD_GET;
  <a name="301" href="#301">301</a>     }
  <a name="302" href="#302">302</a> 
  <a name="303" href="#303">303</a>     String label = atts.getValue(<font color="#000099">"label"</font>);
  <a name="304" href="#304">304</a>     _log.info(<font color="#000099">"creating request with label:"</font>);
  <a name="305" href="#305">305</a>     _log.info(label);
  <a name="306" href="#306">306</a> 
  <a name="307" href="#307">307</a>     <b>boolean</b> followRedirects = <b>true</b>;
  <a name="308" href="#308">308</a>     String followRedirectStr = atts.getValue(<font color="#000099">"followRedirects"</font>);
  <a name="309" href="#309">309</a>     <b>if</b> (<b>null</b> == followRedirectStr) {
  <a name="310" href="#310">310</a>       followRedirects = <b>true</b>;
  <a name="311" href="#311">311</a>     } <b>else</b> <b>if</b> (<font color="#000099">"true"</font>.equalsIgnoreCase(followRedirectStr)) {
  <a name="312" href="#312">312</a>       followRedirects = <b>true</b>;
  <a name="313" href="#313">313</a>     } <b>else</b> {
  <a name="314" href="#314">314</a>       followRedirects = false;
  <a name="315" href="#315">315</a>     }
  <a name="316" href="#316">316</a> 
  <a name="317" href="#317">317</a> 
  <a name="318" href="#318">318</a>     <b>return</b> _session.createRequest(label, url, method, followRedirects);
  <a name="319" href="#319">319</a>   }
  <a name="320" href="#320">320</a> 
  <a name="321" href="#321">321</a>   <b>protected</b> <b>void</b> printFailure(<a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a> req, Exception e) {
  <a name="322" href="#322">322</a>     StringBuffer buf = <b>new</b> StringBuffer();
  <a name="323" href="#323">323</a>     buf.append(<font color="#000099">"REQUEST FAILED for URL "</font>);
  <a name="324" href="#324">324</a>     buf.append(_request.getURL());
  <a name="325" href="#325">325</a>     buf.append(<font color="#000099">": "</font>);
  <a name="326" href="#326">326</a>     buf.append(e);
  <a name="327" href="#327">327</a>     System.out.println(buf.toString());
  <a name="328" href="#328">328</a>   }
  <a name="329" href="#329">329</a> }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/ParameterHandler.html
  
  Index: ParameterHandler.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/ParameterHandler.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>   
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/http/index.html">org.apache.commons.latka.http</a>.<a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a>;
  <a name="63" href="#63">63</a>  
  <a name="64" href="#64">64</a>  <b>import</b> org.xml.sax.Attributes;
  <a name="65" href="#65">65</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="66" href="#66">66</a>  <b>import</b> org.xml.sax.XMLReader;
  <a name="67" href="#67">67</a>  
  <a name="68" href="#68">68</a>  <b>public</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/ParameterHandler.html">ParameterHandler</a> <b>extends</b> <a href="../../../../../org/apache/commons/latka/xml/LatkaHandler.html">LatkaHandler</a> {
  <a name="69" href="#69">69</a>  
  <a name="70" href="#70">70</a>    <b>protected</b> <a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a> _request = <b>null</b>;
  <a name="71" href="#71">71</a>    <b>protected</b> StringBuffer _paramName = <b>null</b>;
  <a name="72" href="#72">72</a>    <b>protected</b> StringBuffer _paramValue = <b>null</b>;
  <a name="73" href="#73">73</a>  
  <a name="74" href="#74">74</a>    <b>protected</b> String _tagName = <b>null</b>;
  <a name="75" href="#75">75</a>    <b>protected</b> String _lastTagName = <b>null</b>;
  <a name="76" href="#76">76</a>  
  <a name="77" href="#77">77</a>    <b>public</b> <a href="../../../../../org/apache/commons/latka/xml/ParameterHandler.html">ParameterHandler</a>(XMLReader reader,
  <a name="78" href="#78">78</a>                            <a href="../../../../../org/apache/commons/latka/http/Request.html">Request</a> request) {
  <a name="79" href="#79">79</a>      <b>super</b>(reader);
  <a name="80" href="#80">80</a>      _request = request;
  <a name="81" href="#81">81</a>    }
  <a name="82" href="#82">82</a>  
  <a name="83" href="#83">83</a>    <b>public</b> <b>void</b> startElement(String uri, String localName, 
  <a name="84" href="#84">84</a>                             String qName, Attributes atts) 
  <a name="85" href="#85">85</a>    throws SAXException {
  <a name="86" href="#86">86</a>      _lastTagName = _tagName;
  <a name="87" href="#87">87</a>      _tagName = localName;
  <a name="88" href="#88">88</a>  
  <a name="89" href="#89">89</a>      <b>if</b> (localName.equals(<font color="#000099">"param"</font>)) {
  <a name="90" href="#90">90</a>        _paramName  = <b>new</b> StringBuffer();
  <a name="91" href="#91">91</a>        _paramValue = <b>new</b> StringBuffer();
  <a name="92" href="#92">92</a>      } <b>else</b> <b>if</b> (localName.equals(<font color="#000099">"paramName"</font>)) {
  <a name="93" href="#93">93</a>      } <b>else</b> <b>if</b> (localName.equals(<font color="#000099">"paramValue"</font>)) {
  <a name="94" href="#94">94</a>      } <b>else</b> {
  <a name="95" href="#95">95</a>        <font color="#329900"><i>// release as soon as all the parameters are processed</font></i>
  <a name="96" href="#96">96</a>        release(uri,localName,qName,atts);
  <a name="97" href="#97">97</a>        <b>return</b>;
  <a name="98" href="#98">98</a>      }
  <a name="99" href="#99">99</a>  
  <a name="100" href="#100">100</a>   }
  <a name="101" href="#101">101</a> 
  <a name="102" href="#102">102</a>   <b>public</b> <b>void</b> <b>char</b>acters(<b>char</b>[] ch, <b>int</b> start, <b>int</b> length) {
  <a name="103" href="#103">103</a>     <b>if</b> (_tagName != <b>null</b>) {
  <a name="104" href="#104">104</a>       <b>if</b> (_tagName.equals(<font color="#000099">"paramName"</font>)) {
  <a name="105" href="#105">105</a>         _paramName.append(ch,start,length);
  <a name="106" href="#106">106</a>       } <b>else</b> <b>if</b> (_tagName.equals(<font color="#000099">"paramValue"</font>)) {
  <a name="107" href="#107">107</a>         _paramValue.append(ch,start,length);
  <a name="108" href="#108">108</a>       }
  <a name="109" href="#109">109</a>     }
  <a name="110" href="#110">110</a>   }
  <a name="111" href="#111">111</a> 
  <a name="112" href="#112">112</a>   <b>public</b> <b>void</b> endElement(String namespaceURI, String localName, 
  <a name="113" href="#113">113</a>                          String rawName) throws SAXException {
  <a name="114" href="#114">114</a>     _tagName = _lastTagName;
  <a name="115" href="#115">115</a> 
  <a name="116" href="#116">116</a>     <b>if</b> (localName.equals(<font color="#000099">"paramValue"</font>)) {
  <a name="117" href="#117">117</a>       _request.addParameter(_paramName.toString(),_paramValue.toString());
  <a name="118" href="#118">118</a>       _tagName = <b>null</b>;
  <a name="119" href="#119">119</a>     } <b>else</b> <b>if</b> (!localName.startsWith(<font color="#000099">"param"</font>)) {
  <a name="120" href="#120">120</a>       release(namespaceURI,localName,rawName);
  <a name="121" href="#121">121</a>     }
  <a name="122" href="#122">122</a> 
  <a name="123" href="#123">123</a>   }
  <a name="124" href="#124">124</a> }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/LatkaVariableEntityResolver.html
  
  Index: LatkaVariableEntityResolver.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/LatkaVariableEntityResolver.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>
  <a name="59" href="#59">59</a>   
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> java.io.IOException;
  <a name="63" href="#63">63</a>  <b>import</b> java.io.StringReader;
  <a name="64" href="#64">64</a>  
  <a name="65" href="#65">65</a>  <b>import</b> java.net.URL;
  <a name="66" href="#66">66</a>  
  <a name="67" href="#67">67</a>  <b>import</b> javax.xml.transform.Source; 
  <a name="68" href="#68">68</a>  <b>import</b> javax.xml.transform.TransformerException;
  <a name="69" href="#69">69</a>  <b>import</b> javax.xml.transform.URIResolver;
  <a name="70" href="#70">70</a>  
  <a name="71" href="#71">71</a>  <b>import</b> javax.xml.transform.sax.SAXSource; 
  <a name="72" href="#72">72</a>  
  <a name="73" href="#73">73</a>  <b>import</b> org.apache.log4j.Category;
  <a name="74" href="#74">74</a>  
  <a name="75" href="#75">75</a>  <b>import</b> org.xml.sax.EntityResolver;
  <a name="76" href="#76">76</a>  <b>import</b> org.xml.sax.InputSource;
  <a name="77" href="#77">77</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="78" href="#78">78</a>  
  <a name="79" href="#79">79</a>  <b>public</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/LatkaVariableEntityResolver.html">LatkaVariableEntityResolver</a> 
  <a name="80" href="#80">80</a>  implements EntityResolver, URIResolver {
  <a name="81" href="#81">81</a>  
  <a name="82" href="#82">82</a>    <b>protected</b> <b>static</b> <b>final</b> Category _log =
  <a name="83" href="#83">83</a>      Category.getInstance(LatkaVariableEntityResolver.<b>class</b>);
  <a name="84" href="#84">84</a>  
  <a name="85" href="#85">85</a>  
  <a name="86" href="#86">86</a>    <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="87" href="#87">87</a>  <font color="#AA0000"><i>   * JAXP equivalent of {@link #resolveEntity(String,String)}.</font></i>
  <a name="88" href="#88">88</a>  <font color="#AA0000"><i>   * </font></i>
  <a name="89" href="#89">89</a>  <font color="#AA0000"><i>   * @param href   URL of the entitiy</font></i>
  <a name="90" href="#90">90</a>  <font color="#AA0000"><i>   * @param base   system id for the entity</font></i>
  <a name="91" href="#91">91</a>  <font color="#AA0000"><i>   * @return JAXP wrapper for the InputSource</font></i>
  <a name="92" href="#92">92</a>  <font color="#AA0000"><i>   * @exception TransformerException</font></i>
  <a name="93" href="#93">93</a>  <font color="#AA0000"><i>   */</font></i>
  <a name="94" href="#94">94</a>    <b>public</b> Source resolve(java.lang.String href,
  <a name="95" href="#95">95</a>                        java.lang.String base)
  <a name="96" href="#96">96</a>    throws TransformerException {
  <a name="97" href="#97">97</a>  
  <a name="98" href="#98">98</a>      <b>try</b> {
  <a name="99" href="#99">99</a>        <b>return</b> <b>new</b> SAXSource(resolveEntity(href,base));
  <a name="100" href="#100">100</a>     } <b>catch</b> (SAXException e) {
  <a name="101" href="#101">101</a>       <b>throw</b> <b>new</b> TransformerException(e.toString());
  <a name="102" href="#102">102</a>     }
  <a name="103" href="#103">103</a> 
  <a name="104" href="#104">104</a>   }
  <a name="105" href="#105">105</a> 
  <a name="106" href="#106">106</a>   <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="107" href="#107">107</a> <font color="#AA0000"><i>   * Preprocesses the URIs, resolving any Latka variables </font></i>
  <a name="108" href="#108">108</a> <font color="#AA0000"><i>   * before returning a modified InputSource.</font></i>
  <a name="109" href="#109">109</a> <font color="#AA0000"><i>   * </font></i>
  <a name="110" href="#110">110</a> <font color="#AA0000"><i>   * @param publicId URL of the entity to retrieve</font></i>
  <a name="111" href="#111">111</a> <font color="#AA0000"><i>   * @param systemId System id for the entity</font></i>
  <a name="112" href="#112">112</a> <font color="#AA0000"><i>   * @return InputSource containing the XML content with all</font></i>
  <a name="113" href="#113">113</a> <font color="#AA0000"><i>   *         variables resolved</font></i>
  <a name="114" href="#114">114</a> <font color="#AA0000"><i>   * @exception SAXException</font></i>
  <a name="115" href="#115">115</a> <font color="#AA0000"><i>   */</font></i>
  <a name="116" href="#116">116</a>   <b>public</b> InputSource resolveEntity(String <b>public</b>Id, String systemId)
  <a name="117" href="#117">117</a>   throws SAXException {
  <a name="118" href="#118">118</a> 
  <a name="119" href="#119">119</a>     _log.debug(<font color="#000099">"Resolving URI: "</font> + systemId);
  <a name="120" href="#120">120</a> 
  <a name="121" href="#121">121</a>     <a href="../../../../../org/apache/commons/latka/xml/XMLPreprocessor.html">XMLPreprocessor</a> process = XMLPreprocessor.instance();
  <a name="122" href="#122">122</a>     <b>try</b> {
  <a name="123" href="#123">123</a>       URL url = <b>new</b> URL(systemId);
  <a name="124" href="#124">124</a>       String xml = process.resolveVariables(url);
  <a name="125" href="#125">125</a>       InputSource source = <b>new</b> InputSource(<b>new</b> StringReader(xml));
  <a name="126" href="#126">126</a>       source.setSystemId(systemId);
  <a name="127" href="#127">127</a>       <b>return</b> source;
  <a name="128" href="#128">128</a>     } <b>catch</b> (IOException e) {
  <a name="129" href="#129">129</a>       <b>throw</b> <b>new</b> SAXException(e);
  <a name="130" href="#130">130</a>     }
  <a name="131" href="#131">131</a>   }
  <a name="132" href="#132">132</a> 
  <a name="133" href="#133">133</a> }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/LatkaHandler.html
  
  Index: LatkaHandler.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/LatkaHandler.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>   
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> <a href="../../../../../org/apache/commons/latka/util/xml/index.html">org.apache.commons.latka.util.xml</a>.<a href="../../../../../org/apache/commons/latka/util/xml/DelegateHandlerImpl.html">DelegateHandlerImpl</a>;
  <a name="63" href="#63">63</a>  
  <a name="64" href="#64">64</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="65" href="#65">65</a>  <b>import</b> org.xml.sax.SAXParseException;
  <a name="66" href="#66">66</a>  <b>import</b> org.xml.sax.XMLReader;
  <a name="67" href="#67">67</a>  
  <a name="68" href="#68">68</a>  <b>public</b> <b>abstract</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/LatkaHandler.html">LatkaHandler</a> <b>extends</b> <a href="../../../../../org/apache/commons/latka/util/xml/DelegateHandlerImpl.html">DelegateHandlerImpl</a> {
  <a name="69" href="#69">69</a>  
  <a name="70" href="#70">70</a>    <b>public</b> <a href="../../../../../org/apache/commons/latka/xml/LatkaHandler.html">LatkaHandler</a>(XMLReader reader) {
  <a name="71" href="#71">71</a>      <b>super</b>(reader);
  <a name="72" href="#72">72</a>    }
  <a name="73" href="#73">73</a>  
  <a name="74" href="#74">74</a>    <b>public</b> <b>void</b> error(SAXParseException e) throws SAXException {
  <a name="75" href="#75">75</a>      <b>throw</b> e;
  <a name="76" href="#76">76</a>    }
  <a name="77" href="#77">77</a>  
  <a name="78" href="#78">78</a>    <b>public</b> <b>void</b> warning(SAXParseException e) throws SAXException {
  <a name="79" href="#79">79</a>      <b>throw</b> e;
  <a name="80" href="#80">80</a>    }
  <a name="81" href="#81">81</a>  
  <a name="82" href="#82">82</a>  }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  
  1.1                  jakarta-commons/docs/latka/xref/java/org/apache/commons/latka/xml/FindVariablesHandler.html
  
  Index: FindVariablesHandler.html
  ===================================================================
  <html>
  <body bgcolor="white">
  <pre>
  <table bgcolor="#FFFFCC" cellpadding="0" cellspacing="0" border="0" width="100%"><a href="../../../../../../../apidocs/org/apache/commons/latka/xml/FindVariablesHandler.html">View Javadoc</a></table>
  <a name="1" href="#1">1</a>   <font color="#329900"><i>/*</font></i>
  <a name="2" href="#2">2</a>   <font color="#329900"><i> * ====================================================================</font></i>
  <a name="3" href="#3">3</a>   <font color="#329900"><i> *</font></i>
  <a name="4" href="#4">4</a>   <font color="#329900"><i> * The Apache Software License, Version 1.1</font></i>
  <a name="5" href="#5">5</a>   <font color="#329900"><i> *</font></i>
  <a name="6" href="#6">6</a>   <font color="#329900"><i> * Copyright (c) 1999 The Apache Software Foundation.  All rights </font></i>
  <a name="7" href="#7">7</a>   <font color="#329900"><i> * reserved.</font></i>
  <a name="8" href="#8">8</a>   <font color="#329900"><i> *</font></i>
  <a name="9" href="#9">9</a>   <font color="#329900"><i> * Redistribution and use in source and binary forms, with or without</font></i>
  <a name="10" href="#10">10</a>  <font color="#329900"><i> * modification, are permitted provided that the following conditions</font></i>
  <a name="11" href="#11">11</a>  <font color="#329900"><i> * are met:</font></i>
  <a name="12" href="#12">12</a>  <font color="#329900"><i> *</font></i>
  <a name="13" href="#13">13</a>  <font color="#329900"><i> * 1. Redistributions of source code must retain the above copyright</font></i>
  <a name="14" href="#14">14</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer. </font></i>
  <a name="15" href="#15">15</a>  <font color="#329900"><i> *</font></i>
  <a name="16" href="#16">16</a>  <font color="#329900"><i> * 2. Redistributions in binary form must reproduce the above copyright</font></i>
  <a name="17" href="#17">17</a>  <font color="#329900"><i> *    notice, this list of conditions and the following disclaimer in</font></i>
  <a name="18" href="#18">18</a>  <font color="#329900"><i> *    the documentation and/or other materials provided with the</font></i>
  <a name="19" href="#19">19</a>  <font color="#329900"><i> *    distribution.</font></i>
  <a name="20" href="#20">20</a>  <font color="#329900"><i> *</font></i>
  <a name="21" href="#21">21</a>  <font color="#329900"><i> * 3. The end-user documentation included with the redistribution, if</font></i>
  <a name="22" href="#22">22</a>  <font color="#329900"><i> *    any, must include the following acknowlegement:  </font></i>
  <a name="23" href="#23">23</a>  <font color="#329900"><i> *       "This product includes software developed by the </font></i>
  <a name="24" href="#24">24</a>  <font color="#329900"><i> *        Apache Software Foundation (<a href="http://www.apache.org/" target="alexandria_uri">http://www.apache.org/</a>)."</font></i>
  <a name="25" href="#25">25</a>  <font color="#329900"><i> *    Alternately, this acknowlegement may appear in the software itself,</font></i>
  <a name="26" href="#26">26</a>  <font color="#329900"><i> *    if and wherever such third-party acknowlegements normally appear.</font></i>
  <a name="27" href="#27">27</a>  <font color="#329900"><i> *</font></i>
  <a name="28" href="#28">28</a>  <font color="#329900"><i> * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software</font></i>
  <a name="29" href="#29">29</a>  <font color="#329900"><i> *    Foundation" must not be used to endorse or promote products derived</font></i>
  <a name="30" href="#30">30</a>  <font color="#329900"><i> *    from this software without prior written permission. For written </font></i>
  <a name="31" href="#31">31</a>  <font color="#329900"><i> *    permission, please contact apache@apache.org.</font></i>
  <a name="32" href="#32">32</a>  <font color="#329900"><i> *</font></i>
  <a name="33" href="#33">33</a>  <font color="#329900"><i> * 5. Products derived from this software may not be called "Apache"</font></i>
  <a name="34" href="#34">34</a>  <font color="#329900"><i> *    nor may "Apache" appear in their names without prior written</font></i>
  <a name="35" href="#35">35</a>  <font color="#329900"><i> *    permission of the Apache Group.</font></i>
  <a name="36" href="#36">36</a>  <font color="#329900"><i> *</font></i>
  <a name="37" href="#37">37</a>  <font color="#329900"><i> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</font></i>
  <a name="38" href="#38">38</a>  <font color="#329900"><i> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</font></i>
  <a name="39" href="#39">39</a>  <font color="#329900"><i> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</font></i>
  <a name="40" href="#40">40</a>  <font color="#329900"><i> * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR</font></i>
  <a name="41" href="#41">41</a>  <font color="#329900"><i> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</font></i>
  <a name="42" href="#42">42</a>  <font color="#329900"><i> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</font></i>
  <a name="43" href="#43">43</a>  <font color="#329900"><i> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</font></i>
  <a name="44" href="#44">44</a>  <font color="#329900"><i> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</font></i>
  <a name="45" href="#45">45</a>  <font color="#329900"><i> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</font></i>
  <a name="46" href="#46">46</a>  <font color="#329900"><i> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</font></i>
  <a name="47" href="#47">47</a>  <font color="#329900"><i> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</font></i>
  <a name="48" href="#48">48</a>  <font color="#329900"><i> * SUCH DAMAGE.</font></i>
  <a name="49" href="#49">49</a>  <font color="#329900"><i> * ====================================================================</font></i>
  <a name="50" href="#50">50</a>  <font color="#329900"><i> *</font></i>
  <a name="51" href="#51">51</a>  <font color="#329900"><i> * This software consists of voluntary contributions made by many</font></i>
  <a name="52" href="#52">52</a>  <font color="#329900"><i> * individuals on behalf of the Apache Software Foundation.  For more</font></i>
  <a name="53" href="#53">53</a>  <font color="#329900"><i> * information on the Apache Software Foundation, please see</font></i>
  <a name="54" href="#54">54</a>  <font color="#329900"><i> * &lt;<a href="http://www.apache.org/&gt" target="alexandria_uri">http://www.apache.org/&gt</a>;.</font></i>
  <a name="55" href="#55">55</a>  <font color="#329900"><i> *</font></i>
  <a name="56" href="#56">56</a>  <font color="#329900"><i> * [Additional notices, if required by prior licensing conditions]</font></i>
  <a name="57" href="#57">57</a>  <font color="#329900"><i> *</font></i>
  <a name="58" href="#58">58</a>  <font color="#329900"><i> */</font></i>   
  <a name="59" href="#59">59</a>  
  <a name="60" href="#60">60</a>  <b>package</b> <a href="../../../../../org/apache/commons/latka/xml/index.html">org.apache.commons.latka.xml</a>;
  <a name="61" href="#61">61</a>  
  <a name="62" href="#62">62</a>  <b>import</b> java.io.InputStreamReader;
  <a name="63" href="#63">63</a>  <b>import</b> java.io.IOException;
  <a name="64" href="#64">64</a>  
  <a name="65" href="#65">65</a>  <b>import</b> java.net.URL;
  <a name="66" href="#66">66</a>  
  <a name="67" href="#67">67</a>  <b>import</b> java.util.HashSet;
  <a name="68" href="#68">68</a>  <b>import</b> java.util.Set;
  <a name="69" href="#69">69</a>  
  <a name="70" href="#70">70</a>  <b>import</b> org.xml.sax.helpers.DefaultHandler;
  <a name="71" href="#71">71</a>  <b>import</b> org.xml.sax.InputSource;
  <a name="72" href="#72">72</a>  <b>import</b> org.xml.sax.SAXException;
  <a name="73" href="#73">73</a>  
  <a name="74" href="#74">74</a>  <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="75" href="#75">75</a>  <font color="#AA0000"><i> * This handler is used by the </font></i>
  <a name="76" href="#76">76</a>  <font color="#AA0000"><i> * {@link XMLPreprocessor#getVariablesFromEntities(InputSource)}</font></i>
  <a name="77" href="#77">77</a>  <font color="#AA0000"><i> * method to read the external entities of an XML</font></i>
  <a name="78" href="#78">78</a>  <font color="#AA0000"><i> * suite and find any variables referenced there.</font></i>
  <a name="79" href="#79">79</a>  <font color="#AA0000"><i> * The only purpose of the suite is to leverage </font></i>
  <a name="80" href="#80">80</a>  <font color="#AA0000"><i> * SAX's awareness of these entities' locations.</font></i>
  <a name="81" href="#81">81</a>  <font color="#AA0000"><i> * </font></i>
  <a name="82" href="#82">82</a>  <font color="#AA0000"><i> * @author Morgan Delagrange</font></i>
  <a name="83" href="#83">83</a>  <font color="#AA0000"><i> * @see XMLPreprocessor#getVariablesFromEntities(InputSource)</font></i>
  <a name="84" href="#84">84</a>  <font color="#AA0000"><i> */</font></i>
  <a name="85" href="#85">85</a>  <b>public</b> <b>class</b> <a href="../../../../../org/apache/commons/latka/xml/FindVariablesHandler.html">FindVariablesHandler</a> <b>extends</b> DefaultHandler {
  <a name="86" href="#86">86</a>  
  <a name="87" href="#87">87</a>    <b>protected</b> Set _set = <b>new</b> HashSet();
  <a name="88" href="#88">88</a>  
  <a name="89" href="#89">89</a>    <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="90" href="#90">90</a>  <font color="#AA0000"><i>   * After the parse is complete, this method returns</font></i>
  <a name="91" href="#91">91</a>  <font color="#AA0000"><i>   * the unique variables referenced in the external entities.</font></i>
  <a name="92" href="#92">92</a>  <font color="#AA0000"><i>   * </font></i>
  <a name="93" href="#93">93</a>  <font color="#AA0000"><i>   * @return Set of unique variables</font></i>
  <a name="94" href="#94">94</a>  <font color="#AA0000"><i>   */</font></i>
  <a name="95" href="#95">95</a>    <b>public</b> Set getVariables() {
  <a name="96" href="#96">96</a>      <b>return</b> _set;
  <a name="97" href="#97">97</a>    }
  <a name="98" href="#98">98</a>  
  <a name="99" href="#99">99</a>    <font color="#AA0000"><i>/**<font color="#AA0000"><i>*</font></i></font></i>
  <a name="100" href="#100">100</a> <font color="#AA0000"><i>   * For each entity, find all the variables and assign them to the</font></i>
  <a name="101" href="#101">101</a> <font color="#AA0000"><i>   * Set.</font></i>
  <a name="102" href="#102">102</a> <font color="#AA0000"><i>   * </font></i>
  <a name="103" href="#103">103</a> <font color="#AA0000"><i>   * @param publicId public id of entity, as defined by SAX</font></i>
  <a name="104" href="#104">104</a> <font color="#AA0000"><i>   * @param systemId file URI of the external entity</font></i>
  <a name="105" href="#105">105</a> <font color="#AA0000"><i>   * @return InputSource used by SAX to find more entities</font></i>
  <a name="106" href="#106">106</a> <font color="#AA0000"><i>   * @exception SAXException</font></i>
  <a name="107" href="#107">107</a> <font color="#AA0000"><i>   *    if the entity could not be read</font></i>
  <a name="108" href="#108">108</a> <font color="#AA0000"><i>   */</font></i>
  <a name="109" href="#109">109</a>   <b>public</b> InputSource resolveEntity(String <b>public</b>Id, String systemId)
  <a name="110" href="#110">110</a>   throws SAXException {
  <a name="111" href="#111">111</a> 
  <a name="112" href="#112">112</a>     <a href="../../../../../org/apache/commons/latka/xml/XMLPreprocessor.html">XMLPreprocessor</a> process = XMLPreprocessor.instance();
  <a name="113" href="#113">113</a>     <b>try</b> {
  <a name="114" href="#114">114</a>       URL url = <b>new</b> URL(systemId);
  <a name="115" href="#115">115</a>       InputStreamReader reader = 
  <a name="116" href="#116">116</a>         <b>new</b> InputStreamReader(url.openConnection().getInputStream());
  <a name="117" href="#117">117</a>       _set.addAll(process.getLocalVariables(reader));
  <a name="118" href="#118">118</a>       InputSource source = <b>new</b> InputSource(systemId);
  <a name="119" href="#119">119</a>       <b>return</b> source;
  <a name="120" href="#120">120</a>     } <b>catch</b> (IOException e) {
  <a name="121" href="#121">121</a>       e.printStackTrace();
  <a name="122" href="#122">122</a>       <b>throw</b> <b>new</b> SAXException(e);
  <a name="123" href="#123">123</a>     }
  <a name="124" href="#124">124</a>   }
  <a name="125" href="#125">125</a> 
  <a name="126" href="#126">126</a> }
  </pre>
  <hr><center>This page automatically generated by Maven</center></body>
  </html>
  
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message