gnu.kawa.xml
Class HttpPrinter
java.lang.Object
gnu.lists.FilterConsumer
gnu.kawa.xml.HttpPrinter
- All Implemented Interfaces:
- Consumer, XConsumer, java.lang.Appendable
- Direct Known Subclasses:
- ServletPrinter
public class HttpPrinter
- extends FilterConsumer
Output as an Http response.
Used for both CGI scripts (default) and HttpServletResponse (future).
Methods inherited from class gnu.lists.FilterConsumer |
append, append, append, beforeContent, beginEntity, endEntity, ignoring, write, write, writeBoolean, writeCDATA, writeComment, writeDouble, writeFloat, writeInt, writeLong, writeProcessingInstruction |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sawContentType
protected java.lang.String sawContentType
ostream
protected java.io.OutputStream ostream
HttpPrinter
public HttpPrinter(java.io.OutputStream out)
HttpPrinter
public HttpPrinter(OutPort out)
make
public static HttpPrinter make(OutPort out)
beforeNode
protected void beforeNode()
- Overrides:
beforeNode
in class FilterConsumer
printHeader
public void printHeader(java.lang.String label,
java.lang.String value)
throws java.io.IOException
- Throws:
java.io.IOException
printHeaders
public void printHeaders()
throws java.io.IOException
- Throws:
java.io.IOException
addHeader
public void addHeader(java.lang.String label,
java.lang.String value)
startAttribute
public void startAttribute(java.lang.Object attrType)
- Description copied from interface:
Consumer
- Write a attribute for the current element.
This is only allowed immediately after a startElement.
- Specified by:
startAttribute
in interface Consumer
- Overrides:
startAttribute
in class FilterConsumer
endAttribute
public void endAttribute()
- Description copied from interface:
Consumer
- End of an attribute or end of an actual parameter.
The former use matches a startAttribute; the latter may not,
and can be used to separate parameters in a parameter list.
This double duty suggsts the method should at least be re-named.
- Specified by:
endAttribute
in interface Consumer
- Overrides:
endAttribute
in class FilterConsumer
beginData
public void beginData()
startElement
public void startElement(java.lang.Object type)
- Specified by:
startElement
in interface Consumer
- Overrides:
startElement
in class FilterConsumer
endElement
public void endElement()
- Specified by:
endElement
in interface Consumer
- Overrides:
endElement
in class FilterConsumer
writeObject
public void writeObject(java.lang.Object v)
- Specified by:
writeObject
in interface Consumer
- Overrides:
writeObject
in class FilterConsumer
write
public void write(java.lang.CharSequence str,
int start,
int length)
- Specified by:
write
in interface Consumer
- Overrides:
write
in class FilterConsumer
write
public void write(char[] buf,
int off,
int len)
- Specified by:
write
in interface Consumer
- Overrides:
write
in class FilterConsumer
startDocument
public void startDocument()
- Specified by:
startDocument
in interface Consumer
- Overrides:
startDocument
in class FilterConsumer
endDocument
public void endDocument()
- Specified by:
endDocument
in interface Consumer
- Overrides:
endDocument
in class FilterConsumer
reset
public boolean reset(boolean headersAlso)
- Try to reset (delete) any response generated so far.
- Parameters:
headersAlso
- if response headers should also be reset.
- Returns:
- true on success, false if it's too late.