org.enhydra.barracuda.core.util.dom
Class JivanDOMWriter

java.lang.Object
  extended byorg.enhydra.barracuda.core.util.dom.JivanDOMWriter
All Implemented Interfaces:
DOMWriter

public class JivanDOMWriter
extends Object
implements DOMWriter

This class is a specialized DOMWriter for Jivan. It calls the Jivan serializers for output to a Outputstream or java.io.Writer. The root node of the tree to be outputted must be either a Document or Element. This means DocumentFragments are not supported. (other node types don't really make sense here) After printout, the subtree is being repaired and ready to be used again.

Author:
Arno, arno@jivan.org

Field Summary
protected  String contentDisposition
           
protected  String contentType
           
protected  boolean leaveWriterOpen
           
protected static org.apache.log4j.Logger logger
           
protected  int maxAge
           
protected  boolean preventCaching
           
 
Constructor Summary
JivanDOMWriter()
          Createing a DOMWriter for outputting a DOM created by Jivan
 
Method Summary
 String getContentDisposition()
          Get the content disposition
 String getContentType()
          Get the content type
 boolean getLeaveWriterOpen()
          return true if the writer is configured to leave the output stream open
 int getMaxAge()
           
 boolean isPreventCaching()
           
 void prepareResponse(javax.servlet.http.HttpServletResponse resp)
          Prepare the response object
 void setContentDisposition(String icontentDisposition)
          Set the content disposition (ie.
 void setContentType(String icontentType)
          Set the content type (defaults to "text/html" or "text/xml" depending on the document type
 void setLeaveWriterOpen(boolean val)
          Set true if we want to leave the writer open (ie. for multiple writes)
 void setMaxAge(int maxAge)
           
 void setPreventCaching(boolean preventCaching)
           
 void write(Node node, javax.servlet.http.HttpServletResponse resp)
          Write a DOM to a ServletResponse object.
 void write(Node node, OutputStream out)
           
 void write(Node node, Writer writer)
          output of the Document of this node using a writer for the output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

preventCaching

protected boolean preventCaching

contentType

protected String contentType

contentDisposition

protected String contentDisposition

leaveWriterOpen

protected boolean leaveWriterOpen

maxAge

protected int maxAge
Constructor Detail

JivanDOMWriter

public JivanDOMWriter()
Createing a DOMWriter for outputting a DOM created by Jivan

Method Detail

setContentType

public void setContentType(String icontentType)
Set the content type (defaults to "text/html" or "text/xml" depending on the document type


getContentType

public String getContentType()
Get the content type


setContentDisposition

public void setContentDisposition(String icontentDisposition)
Set the content disposition (ie. "inline; filename=foo.txt", defaults to null)


getContentDisposition

public String getContentDisposition()
Get the content disposition


setLeaveWriterOpen

public void setLeaveWriterOpen(boolean val)
Set true if we want to leave the writer open (ie. for multiple writes)

Specified by:
setLeaveWriterOpen in interface DOMWriter

getLeaveWriterOpen

public boolean getLeaveWriterOpen()
return true if the writer is configured to leave the output stream open

Specified by:
getLeaveWriterOpen in interface DOMWriter

prepareResponse

public void prepareResponse(javax.servlet.http.HttpServletResponse resp)
                     throws IOException
Prepare the response object

Specified by:
prepareResponse in interface DOMWriter
Parameters:
resp - the HttpServletResponse object
Throws:
IOException

write

public void write(Node node,
                  javax.servlet.http.HttpServletResponse resp)
           throws IOException
Write a DOM to a ServletResponse object. This method will automatically set the content type for you. This method is copied from DefaultDOMWriter. It should really be abstracted from a common base class.

Specified by:
write in interface DOMWriter
Parameters:
node - a DOM node, which belongs to the Document to be written out
resp - the HttpServletResponse object
Throws:
IOException

write

public void write(Node node,
                  OutputStream out)
           throws IOException
Specified by:
write in interface DOMWriter
Throws:
IOException

write

public void write(Node node,
                  Writer writer)
           throws IOException
output of the Document of this node using a writer for the output. After serialization, the Document is being repaired.

Specified by:
write in interface DOMWriter
Throws:
IOException

getMaxAge

public int getMaxAge()
Returns:
Returns the maxAge.

setMaxAge

public void setMaxAge(int maxAge)
Parameters:
maxAge - The maxAge to set.

isPreventCaching

public boolean isPreventCaching()
Returns:
Returns the preventCaching.

setPreventCaching

public void setPreventCaching(boolean preventCaching)
Parameters:
preventCaching - The preventCaching to set.


Copyright © 2003 BarracudaMVC.org All Rights Reserved.