Coverage report

  %line %branch
org.apache.turbine.modules.screens.RawScreen
0% 
0% 

 1  
 package org.apache.turbine.modules.screens;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2004 The Apache Software Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License")
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 // Turbine stuff.
 20  
 
 21  
 import org.apache.ecs.ConcreteElement;
 22  
 import org.apache.turbine.modules.Screen;
 23  
 import org.apache.turbine.util.RunData;
 24  
 
 25  
 /**
 26  
  * Base class for writing Screens that output binary data.  This class
 27  
  * is provided as a helper class for those who want to write Screens
 28  
  * that output raw binary data.  For example, it may be extended into
 29  
  * a Screen that outputs a SVG file or a SWF (Flash Player format)
 30  
  * movie.  The only thing one has to do is to implement the two
 31  
  * methods <code>getContentType(RunData data)</code> and
 32  
  * <code>doOutput(RunData data)</code> (see below).
 33  
  *
 34  
  * <p> You migth want to take a look at the ImageServer screen class
 35  
  * contained in the TDK.<br>
 36  
  *
 37  
  * @author <a href="mailto:rkoenig@chez.com">Regis Koenig</a>
 38  
  * @version $Id: RawScreen.java,v 1.3.2.2 2004/05/20 03:03:54 seade Exp $
 39  
  */
 40  0
 public abstract class RawScreen extends Screen
 41  
 {
 42  
     /**
 43  
      * Build the Screen.  This method actually makes a call to the
 44  
      * doOutput() method in order to generate the Screen content.
 45  
      *
 46  
      * @param data Turbine information.
 47  
      * @return A ConcreteElement.
 48  
      * @exception Exception, a generic exception.
 49  
      */
 50  
     protected final ConcreteElement doBuild(RunData data)
 51  
             throws Exception
 52  
     {
 53  0
         data.getResponse().setContentType(getContentType(data));
 54  0
         data.declareDirectResponse();
 55  0
         doOutput(data);
 56  0
         return null;
 57  
     }
 58  
 
 59  
     /**
 60  
      * Set the content type.  This method should be overidden to
 61  
      * actually set the real content-type header of the output.
 62  
      *
 63  
      * @param data Turbine information.
 64  
      * @return A String with the content type.
 65  
      */
 66  
     protected abstract String getContentType(RunData data);
 67  
 
 68  
     /**
 69  
      * Actually output the dynamic content.  The OutputStream can be
 70  
      * accessed like this: <pre>OutputStream out =
 71  
      * data.getResponse().getOutputStream();</pre>.
 72  
      *
 73  
      * @param data Turbine information.
 74  
      * @exception Exception, a generic exception.
 75  
      */
 76  
     protected abstract void doOutput(RunData data)
 77  
             throws Exception;
 78  
 
 79  
     /**
 80  
      * The layout must be set to null.
 81  
      *
 82  
      * @param data Turbine information.
 83  
      * @return A null String.
 84  
      */
 85  
     public final String getLayout(RunData data)
 86  
     {
 87  0
         return null;
 88  
     }
 89  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.