Hi, Please paste the stack trace of the exception so we can see how you use these methods. A new MarkupStream is created for each rendering of a page. It is being closed at the end of the rendering.
On Tue, Jun 25, 2013 at 2:03 AM, heikki <[email protected]> wrote: > hello, > > I'm using Wicket 1.5.9. I'm trying to do some string manipulation in a > MarkupStream, like this: > > @Override > public IMarkupFragment getMarkup() { > IMarkupFragment fragment = super.getMarkup(); > return manipulate(fragment); > } > > protected IMarkupFragment manipulate(IMarkupFragment fragment) throws > Exception { > MarkupResourceStream markupStream = > fragment.getMarkupResourceStream(); > InputStream is = markupStream.getInputStream(); > String x = getStringFromInputStream(is); > // > // do some string manipulation here on string x > // > return createMarkupFragmentFromString(x); > } > > protected IMarkupFragment createMarkupFragmentFromString(String s) { > IResourceStream resourceStream = new StringResourceStream(s); > MarkupResourceStream markupStream = new > MarkupResourceStream(resourceStream); > IMarkupFragment fragment = new Markup(markupStream); > return fragment; > } > > Unit tests for those last two methods work fine; but when I run it in a > Wicket application, I get a > > IOException: stream already closed. > > Does anyone have an idea what is going wrong, and how could I achieve this? > > Kind regards > Heikki Doeleman > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-change-MarkupStream-tp4659757.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
