org.norther.tammi.spray.engine.tool
Class ContentTool

java.lang.Object
  extended by org.norther.tammi.core.pool.RecyclableSupport
      extended by org.norther.tammi.core.pool.PoolableSupport
          extended by org.norther.tammi.spray.engine.tool.GlobalTool
              extended by org.norther.tammi.spray.engine.tool.ContextTool
                  extended by org.norther.tammi.spray.engine.tool.ContentTool
All Implemented Interfaces:
Serializable, Cloneable, EventListener, Poolable, Recyclable, Content, ContentProcessingListener, ContextBindingListener
Direct Known Subclasses:
PageTool

public class ContentTool
extends ContextTool
implements Content, ContentProcessingListener

A request context tool acting as a content holder.

Version:
$Id: ContentTool.java,v 1.8 2010-08-19 08:48:43 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
ContentTool()
          Constructs a new content.
 
Method Summary
 Content clear()
          Clears the content.
 Object clone()
           
 void dispose()
          Disposes the object by setting its disposed flag.
 void failed(ContentProcessingEvent event)
          Notifies the object that its processing has failed.
 void finished(ContentProcessingEvent event)
          Notifies the object that its processing has finished.
 CharSequence get()
          Gets the content.
 String getTarget()
          The the current content processing target.
 String getTargetEncoding()
          The the content processing target encoding.
 Writer getTargetWriter()
          Gets the content processing target writer.
 void render(File file, String encoding, boolean... options)
          Renders the contents of the specified file.
 void render(InputStream input, String encoding, boolean... options)
          Renders the contents of the specified stream.
 void render(URL url, String encoding, boolean... options)
          Renders the contents of the specified URL.
 CharSequence set(CharSequence content)
          Sets the content.
 void started(ContentProcessingEvent event)
          Notifies the object that its processing has started.
 String toString()
          Converts the tool into a string.
 
Methods inherited from class org.norther.tammi.spray.engine.tool.ContextTool
getFilter, getFilterChain, getFilterKey, getPrincipal, getRequest, getResponse, isFilterChanged
 
Methods inherited from class org.norther.tammi.spray.engine.tool.GlobalTool
getContext, getContextToolFilter, getMBeanServer, isBound, nop, valueBound, valueUnbound
 
Methods inherited from class org.norther.tammi.core.pool.PoolableSupport
disposed, recycled
 
Methods inherited from class org.norther.tammi.core.pool.RecyclableSupport
isDisposed, recycle
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.pool.Recyclable
isDisposed, recycle
 

Constructor Detail

ContentTool

public ContentTool()
Constructs a new content.

Method Detail

clone

public Object clone()
Overrides:
clone in class GlobalTool

dispose

public void dispose()
Description copied from class: RecyclableSupport
Disposes the object by setting its disposed flag.

Specified by:
dispose in interface Recyclable
Overrides:
dispose in class ContextTool

started

public void started(ContentProcessingEvent event)
Description copied from interface: ContentProcessingListener
Notifies the object that its processing has started.

Specified by:
started in interface ContentProcessingListener
Parameters:
event - the processing event.

finished

public void finished(ContentProcessingEvent event)
Description copied from interface: ContentProcessingListener
Notifies the object that its processing has finished.

Specified by:
finished in interface ContentProcessingListener
Parameters:
event - the processing event.

failed

public void failed(ContentProcessingEvent event)
Description copied from interface: ContentProcessingListener
Notifies the object that its processing has failed.

Specified by:
failed in interface ContentProcessingListener
Parameters:
event - the processing event.

get

public CharSequence get()
Description copied from interface: Content
Gets the content.

Specified by:
get in interface Content
Returns:
the content.

set

public CharSequence set(CharSequence content)
Description copied from interface: Content
Sets the content.

Specified by:
set in interface Content
Parameters:
content - the content.
Returns:
the previous content.

clear

public Content clear()
Description copied from interface: Content
Clears the content.

Specified by:
clear in interface Content
Returns:
the updated content.

toString

public String toString()
Description copied from class: GlobalTool
Converts the tool into a string. For most tools, an empty string is a convenient result. Subclasses can implement more specific conversions.

Specified by:
toString in interface Content
Overrides:
toString in class GlobalTool
Returns:
an empty string.

getTarget

public String getTarget()
Description copied from interface: Content
The the current content processing target.

Specified by:
getTarget in interface Content
Returns:
the target name.

getTargetEncoding

public String getTargetEncoding()
Description copied from interface: Content
The the content processing target encoding.

Specified by:
getTargetEncoding in interface Content
Returns:
the target encoding.

getTargetWriter

public Writer getTargetWriter()
Description copied from interface: Content
Gets the content processing target writer.

Specified by:
getTargetWriter in interface Content
Returns:
the target writer.

render

public void render(File file,
                   String encoding,
                   boolean... options)
Renders the contents of the specified file.

Parameters:
file - the file.
encoding - the encoding.
options - the encode xml option.

render

public void render(URL url,
                   String encoding,
                   boolean... options)
Renders the contents of the specified URL.

Parameters:
url - the URL.
encoding - the encoding.
options - the encode xml option.

render

public void render(InputStream input,
                   String encoding,
                   boolean... options)
Renders the contents of the specified stream.

Parameters:
input - the stream.
encoding - the encoding.
options - the encode xml option.


Copyright © 2004 The Norther Organization. All rights reserved.