Clover coverage report - Code Coverage for tapestry release 3.1-alpha-1
Coverage timestamp: Mon Feb 21 2005 09:16:14 EST
file stats: LOC: 98   Methods: 6
NCLOC: 33   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
WMLWriter.java - 66.7% 66.7% 66.7%
coverage coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry.wml;
 16   
 
 17   
 import java.io.OutputStream;
 18   
 
 19   
 import org.apache.tapestry.AbstractMarkupWriter;
 20   
 import org.apache.tapestry.IMarkupWriter;
 21   
 import org.apache.tapestry.util.text.ICharacterTranslatorSource;
 22   
 
 23   
 /**
 24   
  *  This class is used to create WML output.
 25   
  *
 26   
  *  <p>The <code>WMLResponseWriter</code> handles the necessary escaping 
 27   
  *  of invalid characters.
 28   
  *  Specifically, the '$', '&lt;', '&gt;' and '&amp;' characters are properly
 29   
  *  converted to their WML entities by the <code>print()</code> methods.
 30   
  *  Similar measures are taken by the {@link #attribute(String, String)} method.
 31   
  *  Other invalid characters are converted to their numeric entity equivalent.
 32   
  *
 33   
  *  <p>This class makes it easy to generate trivial and non-trivial WML pages.
 34   
  *  It is also useful to generate WML snippets. It's ability to do simple
 35   
  *  formatting is very useful. A JSP may create an instance of the class
 36   
  *  and use it as an alternative to the simple-minded <b>&lt;%= ... %&gt;</b>
 37   
  *  construct, espcially because it can handle null more cleanly.
 38   
  *
 39   
  *  @author David Solis
 40   
  *  @since 0.2.9
 41   
  * 
 42   
  **/
 43   
 
 44   
 public class WMLWriter extends AbstractMarkupWriter
 45   
 {
 46   
     private static final ICharacterTranslatorSource TRANSLATOR_SOURCE = 
 47   
         new WMLCharacterTranslatorSource();
 48   
     
 49   
     /**
 50   
      *  Creates a response writer for content type "text/vnd.wap.wml".
 51   
      * 
 52   
      **/
 53   
 
 54  0
     public WMLWriter(OutputStream stream)
 55   
     {
 56  0
         this(stream, "UTF-8");
 57   
     }
 58   
 
 59   
     /**
 60   
      * 
 61   
      * @param stream the output stream where to write the text
 62   
      * @param encoding the encoding to be used to generate the output
 63   
      * @since 3.0
 64   
      * 
 65   
      **/
 66  20
     public WMLWriter(OutputStream stream, String encoding)
 67   
     {
 68  20
         this("text/vnd.wap.wml", encoding, stream);
 69   
     }
 70   
 
 71  0
     public WMLWriter(String contentType, OutputStream stream)
 72   
     {
 73  0
         super(TRANSLATOR_SOURCE, contentType, stream);
 74   
     }
 75   
 
 76   
     /**
 77   
      * 
 78   
      * @param mimeType the MIME type to be used to generate the content type
 79   
      * @param encoding the encoding to be used to generate the output
 80   
      * @param stream the output stream where to write the text
 81   
      * @since 3.0
 82   
      * 
 83   
      **/
 84  20
     public WMLWriter(String mimeType, String encoding, OutputStream stream)
 85   
     {
 86  20
         super(TRANSLATOR_SOURCE, mimeType, encoding, stream);
 87   
     }
 88   
 
 89  29
     protected WMLWriter(String contentType)
 90   
     {
 91  29
         super(TRANSLATOR_SOURCE, contentType);
 92   
     }
 93   
 
 94  29
     public IMarkupWriter getNestedWriter()
 95   
     {
 96  29
         return new NestedWMLWriter(this);
 97   
     }
 98   
 }