You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jonathan O'Connor <Jo...@xcom.de> on 2004/10/27 11:28:22 UTC
Re: NestedHTMLWriter.class question, tuff one [auf Viren geprueft]
James,
You could try a horrible hack using reflection to get access to the
private field. That will let you bypass the Java protection mechanisms.
I don't remember how to do this, but it was easy enough when I did it
about a year ago.
Ciao,
Jonathan O'Connor
XCOM Dublin
"James Sherwood" <js...@romulin.com>
26/10/2004 14:23
Please respond to
"Tapestry users" <ta...@jakarta.apache.org>
To
"Tapestry users" <ta...@jakarta.apache.org>
cc
Subject
NestedHTMLWriter.class question, tuff one [auf Viren geprueft]
Hello,
Inside of the Body.class there is a function called:
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
Inside this function there is:
IMarkupWriter nested = writer.getNestedWriter();
nested is actually an object of class NestedHTMLWriter(found by stepping
through the code)
(below is the actuall class)
Inside NestedHTMLWriter class is a variable called _internalBuffer.
This is my problem:
I need to see the _internalBuffer but it is private with no getter and
setter.
I tried modifying the actuall class with a setter and getter and readded
it
to the library then used:
String info = new
String(((NestedHTMLWriter)nested).get_internalBuffer().toCharArray());
This throws a class cast exception!!!
NestedHTMLWriter extends HTMLWRiter which extends AbstractMarkupWriter
which
implements IMarkupWriter
so should I not be able to cast too it anyway(even tho the actuall class
returned IS a NestedHTMLWriter.)
I REALLY need to read that variable, someone please help!!
I need to see the HTML of the body at that point and its in that variable.
Thanks in advance,
James
public class NestedHTMLWriter extends HTMLWriter
{
private IMarkupWriter _parent;
private CharArrayWriter _internalBuffer;
public NestedHTMLWriter(IMarkupWriter parent)
{
super(parent.getContentType());
_parent = parent;
_internalBuffer = new CharArrayWriter();
setWriter(new PrintWriter(_internalBuffer));
}
/**
* Invokes the {@link HTMLWriter#close() super-class
* implementation}, then gets the data accumulated in the
* internal buffer and provides it to the containing writer using
* {@link IMarkupWriter#printRaw(char[], int, int)}.
*
*/
public void close()
{
super.close();
char[] data = _internalBuffer.toCharArray();
_parent.printRaw(data, 0, data.length);
_internalBuffer = null;
_parent = null;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org