You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Udo Schnurpfeil <ud...@schnurpfeil.de> on 2007/05/04 12:54:11 UTC
Spec interpretation of ResponseWriter?
Hi all,
I have detected a possible problem with the HtmlResponseWriterImpl.
The write(String) method closes the start tag if open, but the spec says:
6.4 ResponseWriter
[...]
It supports both low-level and high level APIs for writing character
based information
The ResponseWriter class extends java.io.Writer, and therefore inherits
these
method signatures for low-level output.
[...]
The write methods write raw
characters directly to the output writer.public void close() throws
IOException;
[...]
If a Renderer want to write a content text, he should use writeText()
instead.
To explan my problem.
The TobagoResponseWriter doesn't call the "close-tag", because in some
cases we need possibility to write code without auto-closing.
I was playing around using Tomahawk components on Tobago pages, and so
this problem appears.
Any remarks
Udo
Re: Spec interpretation of ResponseWriter?
Posted by Udo Schnurpfeil <ud...@schnurpfeil.de>.
I've just found something in the spec/api (description for startElement):
"The element will be closed (i.e. the trailing > added) on any
subsequent call to
startElement(), writeComment(), writeText(), endDocument(), close(),
flush(), or write()."
So, I've to fix it in the TobagoResponseWriter
Regards,
Udo
Bernd Bohmann schrieb:
> Why i don't use
>
> writer.flush()
> writer.write()
>
> or
>
> writer.writeText(null)
> writer.write
>
> If write() should close a starting element why is this not part of the
> spec or javadoc?
>
> Regards
>
> Bernd
>
>
> Adam Winer wrote:
>> No, write() calls must close a starting element.
>> Otherwise the following sequence:
>>
>> <h:outputLink ...>
>> <h:outputText verbatim="true" .../>
>> </h:outputLink>
>>
>> ... would fail.
>>
>> -- Adam
>>
>>
>> On 5/4/07, Matthias Wessendorf <ma...@apache.org> wrote:
>>> Udo,
>>>
>>> I think you are right, since the write methods are inherited from
>>> abstract Writer clazz.
>>>
>>> <quote>
>>> Methods inherited from class java.io.Writer
>>> close, write, write, write, write, write
>>> </quote>
>>>
>>> Therefore no need to close an open starting (HTML) element
>>>
>>> -M
>>>
>>> On 5/4/07, Udo Schnurpfeil <ud...@schnurpfeil.de> wrote:
>>> > Hi all,
>>> >
>>> > I have detected a possible problem with the HtmlResponseWriterImpl.
>>> > The write(String) method closes the start tag if open, but the
>>> spec says:
>>> >
>>> > 6.4 ResponseWriter
>>> > [...]
>>> > It supports both low-level and high level APIs for writing character
>>> > based information
>>> > The ResponseWriter class extends java.io.Writer, and therefore
>>> inherits
>>> > these
>>> > method signatures for low-level output.
>>> > [...]
>>> > The write methods write raw
>>> > characters directly to the output writer.public void close() throws
>>> > IOException;
>>> > [...]
>>> >
>>> >
>>> > If a Renderer want to write a content text, he should use writeText()
>>> > instead.
>>> >
>>> >
>>> > To explan my problem.
>>> >
>>> > The TobagoResponseWriter doesn't call the "close-tag", because in
>>> some
>>> > cases we need possibility to write code without auto-closing.
>>> >
>>> > I was playing around using Tomahawk components on Tobago pages,
>>> and so
>>> > this problem appears.
>>> >
>>> > Any remarks
>>> >
>>> > Udo
>>> >
>>> >
>>>
>>>
>>> --
>>> Matthias Wessendorf
>>> http://tinyurl.com/fmywh
>>>
>>> further stuff:
>>> blog: http://jroller.com/page/mwessendorf
>>> mail: mwessendorf-at-gmail-dot-com
>>>
>>
>
Re: Spec interpretation of ResponseWriter?
Posted by Adam Winer <aw...@gmail.com>.
On 5/6/07, Bernd Bohmann <be...@atanion.com> wrote:
> Why i don't use
>
> writer.flush()
> writer.write()
>
> or
>
> writer.writeText(null)
> writer.write
... because
(A) it's an utter pain to demand that of all developers
any time they're calling write().
(B) flush() can have larger, undesired consequences
(C) writeText(null) is required to throw a NullPointerException
> If write() should close a starting element why is this not part of the
> spec or javadoc?
It is, as pointed out by Udo. (And, as the original
author of the ResponseWriter API in JSF 1.0, I can
safely say it's also the original intent.)
-- Adam
>
> Regards
>
> Bernd
>
>
> Adam Winer wrote:
> > No, write() calls must close a starting element.
> > Otherwise the following sequence:
> >
> > <h:outputLink ...>
> > <h:outputText verbatim="true" .../>
> > </h:outputLink>
> >
> > ... would fail.
> >
> > -- Adam
> >
> >
> > On 5/4/07, Matthias Wessendorf <ma...@apache.org> wrote:
> >> Udo,
> >>
> >> I think you are right, since the write methods are inherited from
> >> abstract Writer clazz.
> >>
> >> <quote>
> >> Methods inherited from class java.io.Writer
> >> close, write, write, write, write, write
> >> </quote>
> >>
> >> Therefore no need to close an open starting (HTML) element
> >>
> >> -M
> >>
> >> On 5/4/07, Udo Schnurpfeil <ud...@schnurpfeil.de> wrote:
> >> > Hi all,
> >> >
> >> > I have detected a possible problem with the HtmlResponseWriterImpl.
> >> > The write(String) method closes the start tag if open, but the spec
> >> says:
> >> >
> >> > 6.4 ResponseWriter
> >> > [...]
> >> > It supports both low-level and high level APIs for writing character
> >> > based information
> >> > The ResponseWriter class extends java.io.Writer, and therefore inherits
> >> > these
> >> > method signatures for low-level output.
> >> > [...]
> >> > The write methods write raw
> >> > characters directly to the output writer.public void close() throws
> >> > IOException;
> >> > [...]
> >> >
> >> >
> >> > If a Renderer want to write a content text, he should use writeText()
> >> > instead.
> >> >
> >> >
> >> > To explan my problem.
> >> >
> >> > The TobagoResponseWriter doesn't call the "close-tag", because in some
> >> > cases we need possibility to write code without auto-closing.
> >> >
> >> > I was playing around using Tomahawk components on Tobago pages, and so
> >> > this problem appears.
> >> >
> >> > Any remarks
> >> >
> >> > Udo
> >> >
> >> >
> >>
> >>
> >> --
> >> Matthias Wessendorf
> >> http://tinyurl.com/fmywh
> >>
> >> further stuff:
> >> blog: http://jroller.com/page/mwessendorf
> >> mail: mwessendorf-at-gmail-dot-com
> >>
> >
>
Re: Spec interpretation of ResponseWriter?
Posted by Bernd Bohmann <be...@atanion.com>.
Why i don't use
writer.flush()
writer.write()
or
writer.writeText(null)
writer.write
If write() should close a starting element why is this not part of the
spec or javadoc?
Regards
Bernd
Adam Winer wrote:
> No, write() calls must close a starting element.
> Otherwise the following sequence:
>
> <h:outputLink ...>
> <h:outputText verbatim="true" .../>
> </h:outputLink>
>
> ... would fail.
>
> -- Adam
>
>
> On 5/4/07, Matthias Wessendorf <ma...@apache.org> wrote:
>> Udo,
>>
>> I think you are right, since the write methods are inherited from
>> abstract Writer clazz.
>>
>> <quote>
>> Methods inherited from class java.io.Writer
>> close, write, write, write, write, write
>> </quote>
>>
>> Therefore no need to close an open starting (HTML) element
>>
>> -M
>>
>> On 5/4/07, Udo Schnurpfeil <ud...@schnurpfeil.de> wrote:
>> > Hi all,
>> >
>> > I have detected a possible problem with the HtmlResponseWriterImpl.
>> > The write(String) method closes the start tag if open, but the spec
>> says:
>> >
>> > 6.4 ResponseWriter
>> > [...]
>> > It supports both low-level and high level APIs for writing character
>> > based information
>> > The ResponseWriter class extends java.io.Writer, and therefore inherits
>> > these
>> > method signatures for low-level output.
>> > [...]
>> > The write methods write raw
>> > characters directly to the output writer.public void close() throws
>> > IOException;
>> > [...]
>> >
>> >
>> > If a Renderer want to write a content text, he should use writeText()
>> > instead.
>> >
>> >
>> > To explan my problem.
>> >
>> > The TobagoResponseWriter doesn't call the "close-tag", because in some
>> > cases we need possibility to write code without auto-closing.
>> >
>> > I was playing around using Tomahawk components on Tobago pages, and so
>> > this problem appears.
>> >
>> > Any remarks
>> >
>> > Udo
>> >
>> >
>>
>>
>> --
>> Matthias Wessendorf
>> http://tinyurl.com/fmywh
>>
>> further stuff:
>> blog: http://jroller.com/page/mwessendorf
>> mail: mwessendorf-at-gmail-dot-com
>>
>
Re: Spec interpretation of ResponseWriter?
Posted by Adam Winer <aw...@gmail.com>.
No, write() calls must close a starting element.
Otherwise the following sequence:
<h:outputLink ...>
<h:outputText verbatim="true" .../>
</h:outputLink>
... would fail.
-- Adam
On 5/4/07, Matthias Wessendorf <ma...@apache.org> wrote:
> Udo,
>
> I think you are right, since the write methods are inherited from
> abstract Writer clazz.
>
> <quote>
> Methods inherited from class java.io.Writer
> close, write, write, write, write, write
> </quote>
>
> Therefore no need to close an open starting (HTML) element
>
> -M
>
> On 5/4/07, Udo Schnurpfeil <ud...@schnurpfeil.de> wrote:
> > Hi all,
> >
> > I have detected a possible problem with the HtmlResponseWriterImpl.
> > The write(String) method closes the start tag if open, but the spec says:
> >
> > 6.4 ResponseWriter
> > [...]
> > It supports both low-level and high level APIs for writing character
> > based information
> > The ResponseWriter class extends java.io.Writer, and therefore inherits
> > these
> > method signatures for low-level output.
> > [...]
> > The write methods write raw
> > characters directly to the output writer.public void close() throws
> > IOException;
> > [...]
> >
> >
> > If a Renderer want to write a content text, he should use writeText()
> > instead.
> >
> >
> > To explan my problem.
> >
> > The TobagoResponseWriter doesn't call the "close-tag", because in some
> > cases we need possibility to write code without auto-closing.
> >
> > I was playing around using Tomahawk components on Tobago pages, and so
> > this problem appears.
> >
> > Any remarks
> >
> > Udo
> >
> >
>
>
> --
> Matthias Wessendorf
> http://tinyurl.com/fmywh
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>
Re: Spec interpretation of ResponseWriter?
Posted by Matthias Wessendorf <ma...@apache.org>.
Udo,
I think you are right, since the write methods are inherited from
abstract Writer clazz.
<quote>
Methods inherited from class java.io.Writer
close, write, write, write, write, write
</quote>
Therefore no need to close an open starting (HTML) element
-M
On 5/4/07, Udo Schnurpfeil <ud...@schnurpfeil.de> wrote:
> Hi all,
>
> I have detected a possible problem with the HtmlResponseWriterImpl.
> The write(String) method closes the start tag if open, but the spec says:
>
> 6.4 ResponseWriter
> [...]
> It supports both low-level and high level APIs for writing character
> based information
> The ResponseWriter class extends java.io.Writer, and therefore inherits
> these
> method signatures for low-level output.
> [...]
> The write methods write raw
> characters directly to the output writer.public void close() throws
> IOException;
> [...]
>
>
> If a Renderer want to write a content text, he should use writeText()
> instead.
>
>
> To explan my problem.
>
> The TobagoResponseWriter doesn't call the "close-tag", because in some
> cases we need possibility to write code without auto-closing.
>
> I was playing around using Tomahawk components on Tobago pages, and so
> this problem appears.
>
> Any remarks
>
> Udo
>
>
--
Matthias Wessendorf
http://tinyurl.com/fmywh
further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com