org.apache.turbine.modules.screens

## Class RawScreen

- java.lang.Object
- - org.apache.turbine.modules.Assembler
  - - org.apache.turbine.modules.Screen
    - - org.apache.turbine.modules.screens.RawScreen

- Direct Known Subclasses:
    JSONScreen

      public abstract class RawScreen
      extends Screen

  Base class for writing Screens that output binary data. This class is provided as a helper class for those who want to write Screens that output raw binary data. For example, it may be extended into a Screen that outputs a SVG file or a SWF (Flash Player format) movie. The only thing one has to do is to implement the two methods `getContentType(PipelineData data)` and `doOutput(PipelineData data)` (see below).

  You might want to take a look at the ImageServer screen class contained in the TDK.

  Version:
    $Id: RawScreen.java 1773378 2016-12-09 13:19:59Z tv $
  Author:
    Regis Koenig, Peter Courcoux

- - ### Field Summary

    - ### Fields inherited from class org.apache.turbine.modules.Screen

      `CACHE_SIZE_DEFAULT, CACHE_SIZE_KEY, NAME, PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RawScreen()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected String` | `doBuild(PipelineData pipelineData)` Build the Screen.
    `protected abstract void` | `doOutput(PipelineData pipelineData)` Actually output the dynamic content.
    `protected abstract String` | `getContentType(PipelineData pipelineData)` Set the content type.
    `String` | `getLayout(PipelineData pipelineData)` The layout must be set to null.

    - ### Methods inherited from class org.apache.turbine.modules.Screen

      `build, getPrefix, setLayout`

    - ### Methods inherited from class org.apache.turbine.modules.Assembler

      `getRunData`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RawScreen

          public RawScreen()

  - ### Method Detail

    - #### doBuild

          protected final String doBuild(PipelineData pipelineData)
                                  throws Exception

      Build the Screen. This method actually makes a call to the doOutput() method in order to generate the Screen content.
      Specified by:
        `doBuild` in class `Screen`
      Parameters:
        `pipelineData` - Turbine information.
      Returns:
        A ConcreteElement.
      Throws:
        `Exception` - a generic exception.

    - #### getContentType

          protected abstract String getContentType(PipelineData pipelineData)

      Set the content type. This method should be overridden to actually set the real content-type header of the output.
      Parameters:
        `pipelineData` - Turbine information.
      Returns:
        A String with the content type.

    - #### doOutput

          protected abstract void doOutput(PipelineData pipelineData)
                                    throws Exception

      Actually output the dynamic content. The OutputStream can be accessed like this:

          OutputStream out =
           data.getResponse().getOutputStream();

      .
      Parameters:
        `pipelineData` - Turbine information.
      Throws:
        `Exception` - a generic exception.

    - #### getLayout

          public final String getLayout(PipelineData pipelineData)

      The layout must be set to null.
      Overrides:
        `getLayout` in class `Screen`
      Parameters:
        `pipelineData` - Turbine information.
      Returns:
        A null String.

Copyright © 2000–2018 The Apache Software Foundation. All rights reserved.