Class PartialResponseWriterImpl
- java.lang.Object
- 
- java.io.Writer
- 
- jakarta.faces.context.ResponseWriter
- 
- jakarta.faces.context.ResponseWriterWrapper
- 
- jakarta.faces.context.PartialResponseWriter
- 
- org.apache.myfaces.context.PartialResponseWriterImpl
 
 
 
 
 
- 
- All Implemented Interfaces:
- FacesWrapper<ResponseWriter>,- Closeable,- Flushable,- Appendable,- AutoCloseable
 
 public class PartialResponseWriterImpl extends PartialResponseWriter Double buffering partial response writer to take care if embedded CDATA blocks in update delete etc... According to the spec 13.4.4.1 Writing The Partial Response implementations have to take care to handle nested cdata blocks properly This means we cannot allow nested CDATA according to the xml spec http://www.w3.org/TR/REC-xml/#sec-cdata-sect everything within a CDATA block is unparsed except for ]]> Now we have following problem, that CDATA inserts can happen everywhere not only within the CDATA instructions. What we have to do now is to double buffer CDATA blocks until their end and also!!! parse their content for CDATA embedding and replace it with an escaped end sequence. Now parsing CDATA embedding is a little bit problematic in case of PPR because it can happen that someone simply adds a CDATA in a javascript string or somewhere else. Because he/she is not aware that we wrap the entire content into CDATA. Simply encoding and decoding of the CDATA is similarly problematic because the browser then chokes on embedded //<![CDATA[ //]]> sections What we do for now is to simply remove //<![CDATA[ and //]]> and replace all other pending cdatas with their cdata escapes ]]> becomes <![CDATA[]]]]><![CDATA[> If this causes problems in corner cases we also can add a second encoding step in case of the cdata Javascript comment removal is not enough to cover all corner cases. For now I will only implement this in the impl, due to the spec stating that implementations are responsible of the correct CDATA handling! - Version:
- $Revision$ $Date$
- Author:
- Werner Punz (latest modification by $Author$)
 
- 
- 
Field Summary- 
Fields inherited from class jakarta.faces.context.PartialResponseWriterRENDER_ALL_MARKER, VIEW_STATE_MARKER
 
- 
 - 
Constructor SummaryConstructors Constructor Description PartialResponseWriterImpl(ResponseWriter writer)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Writerappend(char c)Writerappend(CharSequence csq)Writerappend(CharSequence csq, int start, int end)ResponseWritercloneWithWriter(Writer writer)voidclose()voidendCDATA()voidendElement(String name)voidendError()voidendEval()voidendExtension()voidendInsert()voidendUpdate()voidflush()voidstartCDATA()voidstartElement(String name, UIComponent component)voidwrite(char[] cbuf)voidwrite(char[] cbuf, int off, int len)voidwrite(int c)voidwrite(String str)voidwrite(String str, int off, int len)voidwriteAttribute(String name, Object value, String property)voidwriteComment(Object comment)voidwriteText(char[] text, int off, int len)voidwriteText(Object object, UIComponent component, String string)voidwriteText(Object text, String property)voidwriteURIAttribute(String name, Object value, String property)- 
Methods inherited from class jakarta.faces.context.PartialResponseWriterdelete, endDocument, redirect, startDocument, startError, startEval, startExtension, startInsertAfter, startInsertBefore, startUpdate, updateAttributes
 - 
Methods inherited from class jakarta.faces.context.ResponseWriterWrappergetCharacterEncoding, getContentType, getWrapped, writeDoctype, writePreamble
 - 
Methods inherited from class java.io.WriternullWriter
 
- 
 
- 
- 
- 
Constructor Detail- 
PartialResponseWriterImplpublic PartialResponseWriterImpl(ResponseWriter writer) 
 
- 
 - 
Method Detail- 
startCDATApublic void startCDATA() throws IOException- Overrides:
- startCDATAin class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
endCDATApublic void endCDATA() throws IOException- Overrides:
- endCDATAin class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
endInsertpublic void endInsert() throws IOException- Overrides:
- endInsertin class- PartialResponseWriter
- Throws:
- IOException
 
 - 
endUpdatepublic void endUpdate() throws IOException- Overrides:
- endUpdatein class- PartialResponseWriter
- Throws:
- IOException
 
 - 
endExtensionpublic void endExtension() throws IOException- Overrides:
- endExtensionin class- PartialResponseWriter
- Throws:
- IOException
 
 - 
endEvalpublic void endEval() throws IOException- Overrides:
- endEvalin class- PartialResponseWriter
- Throws:
- IOException
 
 - 
endErrorpublic void endError() throws IOException- Overrides:
- endErrorin class- PartialResponseWriter
- Throws:
- IOException
 
 - 
endElementpublic void endElement(String name) throws IOException - Overrides:
- endElementin class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
writeCommentpublic void writeComment(Object comment) throws IOException - Overrides:
- writeCommentin class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
startElementpublic void startElement(String name, UIComponent component) throws IOException - Overrides:
- startElementin class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
writeTextpublic void writeText(Object text, String property) throws IOException - Overrides:
- writeTextin class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
writeTextpublic void writeText(char[] text, int off, int len) throws IOException- Overrides:
- writeTextin class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
writepublic void write(char[] cbuf, int off, int len) throws IOException- Overrides:
- writein class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
cloneWithWriterpublic ResponseWriter cloneWithWriter(Writer writer) - Overrides:
- cloneWithWriterin class- ResponseWriterWrapper
 
 - 
writeURIAttributepublic void writeURIAttribute(String name, Object value, String property) throws IOException - Overrides:
- writeURIAttributein class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
closepublic void close() throws IOException- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
flushpublic void flush() throws IOException- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
writeAttributepublic void writeAttribute(String name, Object value, String property) throws IOException - Overrides:
- writeAttributein class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
writeTextpublic void writeText(Object object, UIComponent component, String string) throws IOException - Overrides:
- writeTextin class- ResponseWriterWrapper
- Throws:
- IOException
 
 - 
appendpublic Writer append(char c) throws IOException - Specified by:
- appendin interface- Appendable
- Overrides:
- appendin class- Writer
- Throws:
- IOException
 
 - 
appendpublic Writer append(CharSequence csq, int start, int end) throws IOException - Specified by:
- appendin interface- Appendable
- Overrides:
- appendin class- Writer
- Throws:
- IOException
 
 - 
appendpublic Writer append(CharSequence csq) throws IOException - Specified by:
- appendin interface- Appendable
- Overrides:
- appendin class- Writer
- Throws:
- IOException
 
 - 
writepublic void write(char[] cbuf) throws IOException- Overrides:
- writein class- Writer
- Throws:
- IOException
 
 - 
writepublic void write(int c) throws IOException- Overrides:
- writein class- Writer
- Throws:
- IOException
 
 - 
writepublic void write(String str, int off, int len) throws IOException - Overrides:
- writein class- Writer
- Throws:
- IOException
 
 - 
writepublic void write(String str) throws IOException - Overrides:
- writein class- Writer
- Throws:
- IOException
 
 
- 
 
-