Class RawScreen
- java.lang.Object
-
- org.apache.turbine.modules.screens.RawScreen
-
- Direct Known Subclasses:
JSONScreen
,PlainJSONScreen
public abstract class RawScreen extends Object implements 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 methodsgetContentType(PipelineData data)
anddoOutput(PipelineData data)
(see below).You might want to take a look at the ImageServer screen class contained in the TDK.
- Version:
- $Id$
- Author:
- Regis Koenig, Peter Courcoux
-
-
Field Summary
-
Fields inherited from interface org.apache.turbine.modules.Screen
CACHE_SIZE_DEFAULT, CACHE_SIZE_KEY, NAME, PREFIX
-
-
Constructor Summary
Constructors Constructor Description RawScreen()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Constructor Detail
-
RawScreen
public RawScreen()
-
-
Method Detail
-
doBuild
public 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.
-
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.
-
-