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

java.lang.Object
  |
  +--org.enhydra.barracuda.core.util.dom.DefaultDOMWriter
All Implemented Interfaces:
DOMWriter

public class DefaultDOMWriter
extends java.lang.Object
implements DOMWriter

This class provides the default implementation for writing a DOM. Note that it supports pretty printing (although the default is false).


Field Summary
static boolean defaultPreventCaching
           
static boolean defaultPrintPretty
           
protected  DOMFormatter dfm
           
protected  OutputOptions doo
           
protected  boolean leaveWriterOpen
           
protected static org.apache.log4j.Logger logger
           
protected  int maxAge
           
protected  boolean preventCaching
           
protected  boolean printPretty
           
 
Constructor Summary
DefaultDOMWriter()
          Default constructor
DefaultDOMWriter(boolean printPretty)
          Public constructor.
DefaultDOMWriter(boolean printPretty, boolean preventCaching)
          Public constructor.
DefaultDOMWriter(boolean printPretty, int imaxAge)
          Public constructor.
 
Method Summary
static OutputOptions getDefaultOutputOptions(org.w3c.dom.Document doc)
           
 void setLeaveWriterOpen(boolean val)
           
 void setMaxAge(int imax)
           
 void setPrettyPrint(boolean val)
           
 void setPreventCaching(boolean val)
           
 void write(org.w3c.dom.Node node, javax.servlet.http.HttpServletResponse resp)
          Write a DOM to a ServletResponse object.
 void write(org.w3c.dom.Node node, javax.servlet.http.HttpServletResponse resp, OutputOptions oo)
          Write a DOM to a ServletResponse object.
 void write(org.w3c.dom.Node node, java.io.OutputStream out)
          Write a DOM to an OutputStream.
 void write(org.w3c.dom.Node node, java.io.OutputStream out, OutputOptions oo)
          Write a DOM to an OutputStream.
 void write(org.w3c.dom.Node node, java.io.Writer writer)
          Write a DOM to a Writer.
 void write(org.w3c.dom.Node node, java.io.Writer writer, OutputOptions oo)
          Write a DOM to a Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.log4j.Logger logger

defaultPrintPretty

public static boolean defaultPrintPretty

defaultPreventCaching

public static boolean defaultPreventCaching

dfm

protected DOMFormatter dfm

doo

protected OutputOptions doo

printPretty

protected boolean printPretty

preventCaching

protected boolean preventCaching

leaveWriterOpen

protected boolean leaveWriterOpen

maxAge

protected int maxAge
Constructor Detail

DefaultDOMWriter

public DefaultDOMWriter()
Default constructor


DefaultDOMWriter

public DefaultDOMWriter(boolean printPretty)
Public constructor. Allows you to specify pretty printing.


DefaultDOMWriter

public DefaultDOMWriter(boolean printPretty,
                        boolean preventCaching)
Public constructor. Allows you to specify pretty printing and whether or not the page should be cached.


DefaultDOMWriter

public DefaultDOMWriter(boolean printPretty,
                        int imaxAge)
Public constructor. Allows you to specify pretty printing and the max-age header property for the page (how many seconds until it expires)

Method Detail

write

public void write(org.w3c.dom.Node node,
                  javax.servlet.http.HttpServletResponse resp)
           throws java.io.IOException
Write a DOM to a ServletResponse object. This method will automatically set the content type for you.

Specified by:
write in interface DOMWriter
Parameters:
node - the DOM node to be written out
resp - the HttpServletResponse object
java.io.IOException

write

public void write(org.w3c.dom.Node node,
                  javax.servlet.http.HttpServletResponse resp,
                  OutputOptions oo)
           throws java.io.IOException
Write a DOM to a ServletResponse object. This method will automatically set the content type for you.

Parameters:
node - the DOM node to be written out
resp - the HttpServletResponse object
oo - the target OutputOptions object (may be null)
java.io.IOException

write

public void write(org.w3c.dom.Node node,
                  java.io.OutputStream out)
           throws java.io.IOException
Write a DOM to an OutputStream.

Parameters:
node - the DOM node to be written out
out - the OutputStream to be written to
java.io.IOException

write

public void write(org.w3c.dom.Node node,
                  java.io.OutputStream out,
                  OutputOptions oo)
           throws java.io.IOException
Write a DOM to an OutputStream.

Parameters:
node - the DOM node to be written out
out - the OutputStream to be written to
oo - the target OutputOptions object (may be null)
java.io.IOException

write

public void write(org.w3c.dom.Node node,
                  java.io.Writer writer)
           throws java.io.IOException
Write a DOM to a Writer.

Specified by:
write in interface DOMWriter
Parameters:
node - the DOM node to be written out
writer - the writer to be written to
java.io.IOException

write

public void write(org.w3c.dom.Node node,
                  java.io.Writer writer,
                  OutputOptions oo)
           throws java.io.IOException
Write a DOM to a Writer.

Parameters:
node - the DOM node to be written out
writer - the writer to be written to
oo - the target OutputOptions object (may be null)
java.io.IOException

setPrettyPrint

public void setPrettyPrint(boolean val)

setPreventCaching

public void setPreventCaching(boolean val)

setMaxAge

public void setMaxAge(int imax)

setLeaveWriterOpen

public void setLeaveWriterOpen(boolean val)

getDefaultOutputOptions

public static OutputOptions getDefaultOutputOptions(org.w3c.dom.Document doc)


Copyright © 2001 Enhydra.org