Class PartialResponseWriterImpl
- All Implemented Interfaces:
FacesWrapper<ResponseWriter>
,Closeable
,Flushable
,Appendable
,AutoCloseable
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.PartialResponseWriter
RENDER_ALL_MARKER, VIEW_STATE_MARKER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend
(char c) append
(CharSequence csq) append
(CharSequence csq, int start, int end) cloneWithWriter
(Writer writer) void
close()
void
endCDATA()
void
endElement
(String name) void
endError()
void
endEval()
void
void
void
void
flush()
void
void
startElement
(String name, UIComponent component) void
write
(char[] cbuf) void
write
(char[] cbuf, int off, int len) void
write
(int c) void
void
void
writeAttribute
(String name, Object value, String property) void
writeComment
(Object comment) void
writeText
(char[] text, int off, int len) void
writeText
(Object object, UIComponent component, String string) void
void
writeURIAttribute
(String name, Object value, String property) Methods inherited from class jakarta.faces.context.PartialResponseWriter
delete, endDocument, redirect, startDocument, startError, startEval, startExtension, startInsertAfter, startInsertBefore, startUpdate, updateAttributes
Methods inherited from class jakarta.faces.context.ResponseWriterWrapper
getCharacterEncoding, getContentType, getWrapped, writeDoctype, writePreamble
Methods inherited from class java.io.Writer
nullWriter
-
Constructor Details
-
PartialResponseWriterImpl
-
-
Method Details
-
startCDATA
- Overrides:
startCDATA
in classResponseWriterWrapper
- Throws:
IOException
-
endCDATA
- Overrides:
endCDATA
in classResponseWriterWrapper
- Throws:
IOException
-
endInsert
- Overrides:
endInsert
in classPartialResponseWriter
- Throws:
IOException
-
endUpdate
- Overrides:
endUpdate
in classPartialResponseWriter
- Throws:
IOException
-
endExtension
- Overrides:
endExtension
in classPartialResponseWriter
- Throws:
IOException
-
endEval
- Overrides:
endEval
in classPartialResponseWriter
- Throws:
IOException
-
endError
- Overrides:
endError
in classPartialResponseWriter
- Throws:
IOException
-
endElement
- Overrides:
endElement
in classResponseWriterWrapper
- Throws:
IOException
-
writeComment
- Overrides:
writeComment
in classResponseWriterWrapper
- Throws:
IOException
-
startElement
- Overrides:
startElement
in classResponseWriterWrapper
- Throws:
IOException
-
writeText
- Overrides:
writeText
in classResponseWriterWrapper
- Throws:
IOException
-
writeText
- Overrides:
writeText
in classResponseWriterWrapper
- Throws:
IOException
-
write
- Overrides:
write
in classResponseWriterWrapper
- Throws:
IOException
-
cloneWithWriter
- Overrides:
cloneWithWriter
in classResponseWriterWrapper
-
writeURIAttribute
- Overrides:
writeURIAttribute
in classResponseWriterWrapper
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classResponseWriterWrapper
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classResponseWriterWrapper
- Throws:
IOException
-
writeAttribute
- Overrides:
writeAttribute
in classResponseWriterWrapper
- Throws:
IOException
-
writeText
- Overrides:
writeText
in classResponseWriterWrapper
- Throws:
IOException
-
append
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
- Throws:
IOException
-
append
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
- Throws:
IOException
-
append
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
- Throws:
IOException
-
write
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
- Overrides:
write
in classWriter
- Throws:
IOException
-
write
- Overrides:
write
in classWriter
- Throws:
IOException
-