|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.barracudamvc.core.util.dom.DefaultDOMWriter
This class provides the default implementation for writing a DOM. XMLC is used for formatting the dom. Besides output options features supplied by XMLC, supported features include pretty printing and preventing page caching (which prevents any redisplay of the page even via the back button) or setting a max-age (which generally allows for redisplay of a page via the back button, but not when revisiting the URL). So, the prevent caching and max age features are mutually exclusive. Default behavior is for default output options (obtained automatically from the current document), no pretty printing, and setting a max-age header of 0 (zero). Defaults may be modified via class static variables or overridden explicitly via constructors and/or mutators.
Field Summary | |
protected String |
contentDisposition
|
protected String |
contentType
|
static int |
DEFAULT_MAX_AGE
default value for max age of rendered page, 0 (zero) unless modified at runtime |
static String |
DEFAULT_OO_PUBLIC_ID
default OutputOptions public id (ie. |
static String |
DEFAULT_OO_SYSTEM_ID
default OutputOptions system id (ie. |
static boolean |
DEFAULT_PREVENT_CACHING
default value for preventing caching, false unless modified at runtime |
static boolean |
DEFAULT_PRINT_PRETTY
default value for pretty printing, false unless modified at runtime |
protected org.enhydra.xml.io.DOMFormatter |
dfm
|
protected boolean |
leaveWriterOpen
|
protected static org.apache.log4j.Logger |
logger
|
protected int |
maxAge
|
protected org.enhydra.xml.io.OutputOptions |
oo
|
protected boolean |
preventCaching
|
protected boolean |
printPretty
|
Constructor Summary | |
DefaultDOMWriter()
Default constructor |
|
DefaultDOMWriter(boolean printPretty)
Public constructor. |
|
DefaultDOMWriter(org.enhydra.xml.io.OutputOptions oo)
Public constructor. |
|
DefaultDOMWriter(org.enhydra.xml.io.OutputOptions ioo,
boolean iprintPretty,
boolean ipreventCaching,
int imaxAge)
Public constructor. |
Method Summary | |
String |
getContentDisposition()
Get the content disposition |
String |
getContentType()
Get the content type |
static org.enhydra.xml.io.OutputOptions |
getDefaultOutputOptions(Document doc)
|
boolean |
getLeaveWriterOpen()
return true if the writer is configured to leave the output stream open |
org.enhydra.xml.io.OutputOptions |
getOutputOptions()
|
void |
prepareResponse(Node node,
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 imax)
|
void |
setOutputOptions(org.enhydra.xml.io.OutputOptions ioo)
|
void |
setPrettyPrint(boolean val)
|
void |
setPreventCaching(boolean val)
|
void |
write(Node node,
javax.servlet.http.HttpServletResponse resp)
Write a DOM to a ServletResponse object. |
void |
write(Node node,
OutputStream out)
Write a DOM to an OutputStream. |
void |
write(Node node,
Writer writer)
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 |
protected static final org.apache.log4j.Logger logger
public static String DEFAULT_OO_PUBLIC_ID
public static String DEFAULT_OO_SYSTEM_ID
public static boolean DEFAULT_PRINT_PRETTY
public static boolean DEFAULT_PREVENT_CACHING
public static int DEFAULT_MAX_AGE
protected org.enhydra.xml.io.DOMFormatter dfm
protected org.enhydra.xml.io.OutputOptions oo
protected String contentType
protected String contentDisposition
protected boolean printPretty
protected boolean preventCaching
protected boolean leaveWriterOpen
protected int maxAge
Constructor Detail |
public DefaultDOMWriter()
public DefaultDOMWriter(org.enhydra.xml.io.OutputOptions oo)
oo
- OutputOptions to specify how the DOM should be formattedpublic DefaultDOMWriter(boolean printPretty)
printPretty
- true if pretty printpublic DefaultDOMWriter(org.enhydra.xml.io.OutputOptions ioo, boolean iprintPretty, boolean ipreventCaching, int imaxAge)
ioo
- OutputOptions to specify how the DOM should be formatted, may be nulliprintPretty
- true if pretty printipreventCaching
- true if we want to prevent client side caching of the pageimaxAge
- how many seconds until the page should expireMethod Detail |
public void setContentType(String icontentType)
public String getContentType()
public void setContentDisposition(String icontentDisposition)
public String getContentDisposition()
public void setLeaveWriterOpen(boolean val)
setLeaveWriterOpen
in interface DOMWriter
public boolean getLeaveWriterOpen()
getLeaveWriterOpen
in interface DOMWriter
public void prepareResponse(Node node, javax.servlet.http.HttpServletResponse resp) throws IOException
prepareResponse
in interface DOMWriter
node
- the DOM node to be written outresp
- the HttpServletResponse object
IOException
public void write(Node node, javax.servlet.http.HttpServletResponse resp) throws IOException
write
in interface DOMWriter
node
- the DOM node to be written outresp
- the HttpServletResponse object
IOException
public void write(Node node, OutputStream out) throws IOException
write
in interface DOMWriter
node
- the DOM node to be written outout
- the OutputStream to be written to
IOException
public void write(Node node, Writer writer) throws IOException
write
in interface DOMWriter
node
- the DOM node to be written outwriter
- the writer to be written to
IOException
public void setPrettyPrint(boolean val)
public void setPreventCaching(boolean val)
public void setMaxAge(int imax)
public void setOutputOptions(org.enhydra.xml.io.OutputOptions ioo)
public org.enhydra.xml.io.OutputOptions getOutputOptions()
public static org.enhydra.xml.io.OutputOptions getDefaultOutputOptions(Document doc)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |