myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Hookom <ja...@hookom.net>
Subject ResponseWriter Question
Date Mon, 20 Mar 2006 08:26:17 GMT
I noticed in the ResponseWriter:

public void writeText(char cbuf[], int off, int len)
        throws IOException
    {
        if(cbuf == null)
            throw new NullPointerException("cbuf name must not be null");
        if(cbuf.length < off + len)
            throw new IndexOutOfBoundsException((off + len) + " >
" + cbuf.length);
        closeStartTagIfNecessary();
        if(isScriptOrStyle())
        {
            String strValue = new String(cbuf, off, len);
            _writer.write(UnicodeEncoder.encode(strValue, false, false));
        } else
        if(isTextarea())
        {
            String strValue = new String(cbuf, off, len);
            _writer.write(HTMLEncoder.encode(strValue, false, false));
        } else
        {
            String strValue = new String(cbuf, off, len);
            _writer.write(HTMLEncoder.encode(strValue, true, true));
        }
    }

In the last case:

HTMLEncoder.encode(strValue, true, true)

Why would you want to tell the HTMLEncoder to write out a line break in 
this case and this case only?

Adam and I are trying to get Facelets to go pure ResponseWriter for all 
encode events, but this little quirk causes pages to render with lots of 
breaks in MyFaces (this doesn't happen in the RI).

-- 
Jacob Hookom  -  Minneapolis
----------------------------
JSF-EG, JSF-RI, EL, Facelets


Mime
View raw message